From a3c729c3b234be49d43f917132146df0109ecdfe Mon Sep 17 00:00:00 2001 From: 4rumprom <84041172+4rumprom@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:45:25 -0400 Subject: [PATCH] Update authentication.py Correcting typo and adding robustness --- schwab_api/authentication.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schwab_api/authentication.py b/schwab_api/authentication.py index ac7a8ed..71285a2 100644 --- a/schwab_api/authentication.py +++ b/schwab_api/authentication.py @@ -34,7 +34,7 @@ def get_session(self): return self.session def login(self, username, password, totp_secret=None): - """ This function will log the user into schwab using asynchoneous Playwright and saving + """ This function will log the user into schwab using asynchronous Playwright and saving the authentication cookies in the session header. :type username: str :param username: The username for the schwab account. @@ -93,7 +93,7 @@ async def _async_login(self, username, password, totp_secret=None): try: await self.page.frame(name=login_frame).press("[placeholder=\"Password\"]", "Enter") - await self.page.wait_for_url(urls.trade_ticket()) + await self.page.wait_for_url(".*app/trade.*") # Making it more robust than specigying an exact url which may change. except TimeoutError: raise Exception("Login was not successful; please check username and password")