accounts client
This commit is contained in:
parent
50f57875e0
commit
4f8c409637
1 changed files with 8 additions and 5 deletions
|
|
@ -10,9 +10,6 @@ from gooyal_accounts_client.api.users import users_api_users_retrieve
|
||||||
from gooyal_accounts_client.api.oauth2 import oauth2_apis_applications_retrieve
|
from gooyal_accounts_client.api.oauth2 import oauth2_apis_applications_retrieve
|
||||||
from gooyal_accounts_client.types import Response
|
from gooyal_accounts_client.types import Response
|
||||||
|
|
||||||
from authlib.integrations.django_client import OAuth
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def login_as_client_credentials():
|
def login_as_client_credentials():
|
||||||
access_token = cache.get('wallet_access_token')
|
access_token = cache.get('wallet_access_token')
|
||||||
|
|
@ -40,7 +37,7 @@ def login_as_client_credentials():
|
||||||
auth_data = response.json()
|
auth_data = response.json()
|
||||||
if 'access_token' in auth_data:
|
if 'access_token' in auth_data:
|
||||||
auth_data['created_at'] = time.time()
|
auth_data['created_at'] = time.time()
|
||||||
cache.set('wallet_access_token', auth_data)
|
cache.set('wallet_access_token', auth_data, timeout=auth_data.get('expires_in')-5)
|
||||||
|
|
||||||
return auth_data
|
return auth_data
|
||||||
|
|
||||||
|
|
@ -56,4 +53,10 @@ def get_user_details(uuid):
|
||||||
# or if you need more info (e.g. status_code)
|
# or if you need more info (e.g. status_code)
|
||||||
# response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
|
# response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def get_application_details(uuid):
|
||||||
|
data: Application = oauth2_apis_applications_retrieve.sync(client=client, id=uuid)
|
||||||
|
print(data)
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue