1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 08:17:13 +03:00

CAPI: Add retry of request after refreshing Access Token

This commit is contained in:
Athanasius 2021-11-05 17:57:35 +00:00
parent 8e32ecd216
commit 7a52ddd278
No known key found for this signature in database
GPG Key ID: AE3E527847057C7D
2 changed files with 3 additions and 1 deletions

View File

@ -1165,6 +1165,8 @@ class AppWindow(object):
if companion.session.login():
logger.debug('Initial query failed, but login() just worked, trying again...')
companion.session.retrying = True
self.w.after(int(SERVER_RETRY * 1000), lambda: self.capi_request_data(event))
return # early exit to avoid starting cooldown count
except companion.CredentialsError:
companion.session.retrying = False

View File

@ -784,7 +784,7 @@ class Session(object):
# TODO: This needs to try a REFRESH, not a full re-auth
# No need for translation, we'll go straight into trying new Auth
# and thus any message would be overwritten.
raise CredentialsError('Frontier CAPI said Auth required') from e
raise CredentialsRequireRefresh('Frontier CAPI said "unauthorized"') from e
if r.status_code == 418: # "I'm a teapot" - used to signal maintenance
# LANG: Frontier CAPI returned 418, meaning down for maintenance