From 454709fff514a1bc417e7d352563e9b99411f4bd Mon Sep 17 00:00:00 2001 From: 4rumprom <84041172+4rumprom@users.noreply.github.com> Date: Thu, 22 Feb 2024 12:01:51 -0500 Subject: [PATCH] Update authentication.py --- schwab_api/authentication.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/schwab_api/authentication.py b/schwab_api/authentication.py index 65b0c7c..f83239d 100644 --- a/schwab_api/authentication.py +++ b/schwab_api/authentication.py @@ -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: @@ -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 ) @@ -146,4 +146,4 @@ def login(self, username, password, totp_secret=None): # Save our session self.save_and_close_session() - return True \ No newline at end of file + return True