aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask/oauth2/client.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-05-14 09:30:15 +0300
committerFrederick Muriuki Muriithi2024-05-14 09:31:30 +0300
commit8a4ab36a4691db03f731f918b7c4e6ff859157ee (patch)
tree83ce679a2834fedc70e152df331aa5e32aced77a /gn2/wqflask/oauth2/client.py
parentd80bf00d16048c0f1dbc5635ce6bf52411d44346 (diff)
downloadgenenetwork2-8a4ab36a4691db03f731f918b7c4e6ff859157ee.tar.gz
Consistently use the same OAuthSession client
Diffstat (limited to 'gn2/wqflask/oauth2/client.py')
-rw-r--r--gn2/wqflask/oauth2/client.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/gn2/wqflask/oauth2/client.py b/gn2/wqflask/oauth2/client.py
index f4ad4f00..75e438cc 100644
--- a/gn2/wqflask/oauth2/client.py
+++ b/gn2/wqflask/oauth2/client.py
@@ -73,10 +73,7 @@ def __no_token__(_err) -> Left:
def oauth2_get(uri_path: str, data: dict = {},
jsonify_p: bool = False, **kwargs) -> Either:
def __get__(token) -> Either:
- client = OAuth2Session(
- oauth2_clientid(), oauth2_clientsecret(),
- token=token, scope=SCOPE)
- resp = client.get(
+ resp = oauth2_client().get(
urljoin(authserver_uri(), uri_path),
data=data,
**kwargs)
@@ -93,10 +90,7 @@ def oauth2_post(
uri_path: str, data: Optional[dict] = None, json: Optional[dict] = None,
**kwargs) -> Either:
def __post__(token) -> Either:
- client = OAuth2Session(
- oauth2_clientid(), oauth2_clientsecret(),
- token=token, scope=SCOPE)
- resp = client.post(
+ resp = oauth2_client().post(
urljoin(authserver_uri(), uri_path), data=data, json=json,
**kwargs)
if resp.status_code == 200: