Skip to content

Commit

Permalink
Merge pull request #47 from 4rumprom/USER_AGENT-fix-for-login
Browse files Browse the repository at this point in the history
Update USER_AGENT in authentication.py
  • Loading branch information
itsjafer authored Feb 22, 2024
2 parents 4c23d53 + 454709f commit 07d2b7d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions schwab_api/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


# Constants
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36"
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:{version}) Gecko/20100101 Firefox/"
VIEWPORT = { 'width': 1920, 'height': 1080 }

class SessionManager:
Expand All @@ -23,12 +23,12 @@ def __init__(self) -> None:
headless=self.headless
)
else:
self.browser = self.playwright.webkit.launch(
headless=self.headless
)
#webkit doesn't or no longer works when trying to log in.
raise ValueError("Only supported browserType is 'firefox'")

user_agent = USER_AGENT + self.browser.version
self.page = self.browser.new_page(
user_agent=USER_AGENT,
user_agent=user_agent,
viewport=VIEWPORT
)

Expand Down Expand Up @@ -146,4 +146,4 @@ def login(self, username, password, totp_secret=None):
# Save our session
self.save_and_close_session()

return True
return True

0 comments on commit 07d2b7d

Please sign in to comment.