You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of Bug
With asyncio=True, and streamer running, gets error when trying to run get_accounts() method and the token has expired and needs to be updated.
Code to Reproduce
Paste in the code that causes the bug to occur.
classTDABot():
def__init__(self, bot, cog, client_id, ref_url=None):
self.bot=botself.cog=cogself.client_id=client_idself.ref_url=ref_urlifnotos.path.exists(TOKEN_PATH):
self.client=easy_client(self.client_id, self.ref_url, TOKEN_PATH,
webdriver_func=lambda: webdriver.Chrome(
ChromeDriverManager().install()),
asyncio=True)
else:
self.client=client_from_token_file(
TOKEN_PATH, self.client_id, asyncio=True)
asyncdefget_bp(self):
print("get_bp command running")
accts=awaitself.client.get_accounts()
acct_info=accts.json()
bp=acct_info[0]['securitiesAccount']['projectedBalances']['availableFunds']
returnbpasyncdefread_stream(self, user, account_id):
try:
stream_client=StreamClient(
self.client, account_id=int(account_id))
awaitstream_client.login()
awaituser.send(f":white_check_mark: TDA account activity streamer started for account id: {account_id}\n\ (You can now close this DM.)")
awaitstream_client.quality_of_service(StreamClient.QOSLevel.EXPRESS)
awaitstream_client.account_activity_sub()
stream_client.add_account_activity_handler(self.get_activity)
whileTrue:
awaitstream_client.handle_message()
exceptUnexpectedResponseCodease:
awaituser.send(f":x: Login failed, error: {e} - RESTART BOT AND TRY AGAIN")
finally:
awaitself.client.close_async_session()
Expected Behavior
Update the token, write the token, return info requested, then continue the program
Actual Behavior
errors out, need to run the command again, but then it works.
Description of Bug
With asyncio=True, and streamer running, gets error when trying to run
get_accounts()
method and the token has expired and needs to be updated.Code to Reproduce
Paste in the code that causes the bug to occur.
Expected Behavior
Update the token, write the token, return info requested, then continue the program
Actual Behavior
errors out, need to run the command again, but then it works.
Error/Exception Log, If Applicable
Possible causes:
(https://github.com/lepture/authlib/blob/f17395323555de638eceecf51b535da5b91fcb0a/authlib/integrations/httpx_client/oauth2_client.py#L162)
calls this function of the library when the token is updated:
(https://github.com/alexgolec/tda-api/blob/b640f1f677249d8f127b7cf2de13dc55216c410e/tda/auth.py#L26:L32)
The text was updated successfully, but these errors were encountered: