Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update USER_AGENT in authentication.py #47

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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