From ba6876eeb5638339abde01c291ed7fae7657b2ed Mon Sep 17 00:00:00 2001 From: Nelson Dane <47427072+NelsonDane@users.noreply.github.com> Date: Mon, 8 Jul 2024 14:07:46 -0500 Subject: [PATCH 1/2] disable some stealth options --- schwab_api/authentication.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/schwab_api/authentication.py b/schwab_api/authentication.py index a98c173..dc60c01 100644 --- a/schwab_api/authentication.py +++ b/schwab_api/authentication.py @@ -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 @@ -135,7 +136,11 @@ 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 + await stealth_async(self.page, config) await self.page.goto("https://www.schwab.com/") await self.page.route(re.compile(r".*balancespositions*"), self._asyncCaptureAuthToken) From d9185cda7d7211f0a8dd850a26f619472a441ca7 Mon Sep 17 00:00:00 2001 From: Nelson Dane <47427072+NelsonDane@users.noreply.github.com> Date: Thu, 11 Jul 2024 10:50:14 -0500 Subject: [PATCH 2/2] allow vendor --- schwab_api/authentication.py | 1 + 1 file changed, 1 insertion(+) diff --git a/schwab_api/authentication.py b/schwab_api/authentication.py index dc60c01..905ab45 100644 --- a/schwab_api/authentication.py +++ b/schwab_api/authentication.py @@ -140,6 +140,7 @@ async def _async_login(self): 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/")