schwab-api
schwab-api copied to clipboard
schwab-api is incompatible with the latest version of playwright-stealth (ImportError: cannot import name 'stealth_async' from 'playwright_stealth')
The example from the README:
from schwab_api import generate_totp
symantec_id, totp_secret = generate_totp()
print("Your symantec ID is: " + symantec_id)
print("Your TOTP secret is: " + totp_secret)
gives:
Cell In[1], line 2
1 # %%
----> 2 from schwab_api import generate_totp
4 symantec_id, totp_secret = generate_totp()
6 print("Your symantec ID is: " + symantec_id)
File ~/Documents/GitHub/schwab-api/schwab_api/__init__.py:1
----> 1 from .schwab import Schwab
2 from .totp_generator import generate_totp
File ~/Documents/GitHub/schwab-api/schwab_api/schwab.py:8
6 from . import urls
7 from .account_information import Position, Account
----> 8 from .authentication import SessionManager
10 class Schwab(SessionManager):
11 def __init__(self, session_cache=None, **kwargs):
File ~/Documents/GitHub/schwab-api/schwab_api/authentication.py:10
8 import asyncio
9 from playwright.async_api import async_playwright, TimeoutError
---> 10 from playwright_stealth import stealth_async
11 from playwright_stealth.stealth import StealthConfig
12 from requests.cookies import cookiejar_from_dict
ImportError: cannot import name 'stealth_async' from 'playwright_stealth' (/Users/jason/Documents/GitHub/schwab-api/.venv/lib/python3.11/site-packages/playwright_stealth/__init__.py)
This is with versions
% pip freeze
certifi==2025.6.15
charset-normalizer==3.4.2
greenlet==3.2.3
idna==3.10
oath==1.4.4
playwright==1.53.0
playwright-stealth==2.0.0
pycryptodome==3.23.0
pyee==13.0.0
pyotp==2.9.0
python-vipaccess==0.14.2
requests==2.32.4
schwab_api==0.4.3
typing_extensions==4.14.1
urllib3==2.5.0
This can be fixed by running pip install 'playwright-stealth<2', as per https://github.com/AtuboDad/playwright_stealth/issues/40 and https://github.com/Mattwmaster58/playwright_stealth/blob/main/CHANGELOG.md, cf
2.0.0
- breaking change: more consistent naming all around
- breaking change: Stealth object only takes kwargs now