Skip to content

Commit

Permalink
Update authentication.py
Browse files Browse the repository at this point in the history
Correcting typo and adding robustness
  • Loading branch information
4rumprom authored Mar 12, 2024
1 parent 3841f59 commit a3c729c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions schwab_api/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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")

Expand Down

0 comments on commit a3c729c

Please sign in to comment.