mirror of
https://github.com/norohind/FDEV-CAPI-Handler.git
synced 2025-06-05 01:43:15 +03:00
Fix retries logic in web.RandomToken
This commit is contained in:
parent
d42991fcd7
commit
e182cde7d1
10
web.py
10
web.py
@ -130,17 +130,17 @@ class RandomToken:
|
||||
if len(list_users) == 0:
|
||||
raise falcon.HTTPNotFound(description='No users in DB')
|
||||
|
||||
random_user_tokens = None
|
||||
|
||||
for attempt in range(0, 3):
|
||||
random_user = random.choice(list_users)
|
||||
random_user_tokens = capi_authorizer.get_token_by_state(random_user['state'])
|
||||
if random_user_tokens is None or 'access_token' not in random_user_tokens: # To be sure
|
||||
continue
|
||||
if random_user_tokens is not None and 'access_token' in random_user_tokens: # To be sure
|
||||
break
|
||||
|
||||
if random_user_tokens is None or 'access_token' not in random_user_tokens:
|
||||
else:
|
||||
raise falcon.HTTPInternalServerError
|
||||
|
||||
# if random_user_tokens is None or 'access_token' not in random_user_tokens:
|
||||
|
||||
resp.text = json.dumps(random_user_tokens)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user