Raise any unexpected error
parent
0faec1537e
commit
b41b262b7d
|
@ -125,15 +125,16 @@ class Client:
|
||||||
try:
|
try:
|
||||||
data = await self._new_auth_token()
|
data = await self._new_auth_token()
|
||||||
except QuestradeError as qterr:
|
except QuestradeError as qterr:
|
||||||
if "We're making some changes" in qterr.args[0]:
|
if "We're making some changes" in str(qterr.args[0]):
|
||||||
# API service is down
|
# API service is down
|
||||||
raise QuestradeError("API is down for maintenance")
|
raise QuestradeError("API is down for maintenance")
|
||||||
|
|
||||||
elif qterr.args[0].decode() == 'Bad Request':
|
elif qterr.args[0].decode() == 'Bad Request':
|
||||||
# likely config ``refresh_token`` is expired
|
# likely config ``refresh_token`` is expired
|
||||||
_token_from_user(self._conf)
|
_token_from_user(self._conf)
|
||||||
self._apply_config(self._conf)
|
self._apply_config(self._conf)
|
||||||
data = await self._new_auth_token()
|
data = await self._new_auth_token()
|
||||||
|
else:
|
||||||
|
raise qterr
|
||||||
|
|
||||||
# store absolute token expiry time
|
# store absolute token expiry time
|
||||||
self.access_data['expires_at'] = time.time() + float(
|
self.access_data['expires_at'] = time.time() + float(
|
||||||
|
|
Loading…
Reference in New Issue