mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-09 11:52:27 +03:00
CAPI: Add retry of request after refreshing Access Token
This commit is contained in:
parent
8e32ecd216
commit
7a52ddd278
@ -1165,6 +1165,8 @@ class AppWindow(object):
|
|||||||
if companion.session.login():
|
if companion.session.login():
|
||||||
logger.debug('Initial query failed, but login() just worked, trying again...')
|
logger.debug('Initial query failed, but login() just worked, trying again...')
|
||||||
companion.session.retrying = True
|
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:
|
except companion.CredentialsError:
|
||||||
companion.session.retrying = False
|
companion.session.retrying = False
|
||||||
|
@ -784,7 +784,7 @@ class Session(object):
|
|||||||
# TODO: This needs to try a REFRESH, not a full re-auth
|
# TODO: This needs to try a REFRESH, not a full re-auth
|
||||||
# No need for translation, we'll go straight into trying new Auth
|
# No need for translation, we'll go straight into trying new Auth
|
||||||
# and thus any message would be overwritten.
|
# 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
|
if r.status_code == 418: # "I'm a teapot" - used to signal maintenance
|
||||||
# LANG: Frontier CAPI returned 418, meaning down for maintenance
|
# LANG: Frontier CAPI returned 418, meaning down for maintenance
|
||||||
|
Loading…
x
Reference in New Issue
Block a user