Skip to content

Commit

Permalink
Merge pull request #64 from NelsonDane/main
Browse files Browse the repository at this point in the history
Disable stealth options which block login iframe
  • Loading branch information
itsjafer committed Jul 20, 2024
2 parents ecefaef + d9185cd commit 529344a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion schwab_api/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import asyncio
from playwright.async_api import async_playwright, TimeoutError
from playwright_stealth import stealth_async
from playwright_stealth.stealth import StealthConfig
from requests.cookies import cookiejar_from_dict


Expand Down Expand Up @@ -135,7 +136,12 @@ async def _async_login(self):
user_agent=user_agent,
viewport=VIEWPORT
)
await stealth_async(self.page)

config = StealthConfig()
config.navigator_languages = False
config.navigator_user_agent = False
config.navigator_vendor = False
await stealth_async(self.page, config)

await self.page.goto("https://www.schwab.com/")
await self.page.route(re.compile(r".*balancespositions*"), self._asyncCaptureAuthToken)
Expand Down

0 comments on commit 529344a

Please sign in to comment.