playwright-proxy-authentication
Use authenticated and rotating proxies with Playwright without fighting its proxy API. Turn an ordinary scheme://user:pass@host:port URL into the dict Playwright expects, and hand out a fresh exit IP per browser context.
pip install playwright-proxy-authentication
The problem
Unlike requests or Scrapy, Playwright ignores credentials in a proxy URL. This silently fails to authenticate:
# ❌ username/password are dropped — you get 407 Proxy Authentication Required
browser.new_context(proxy={"server": "http://user:pass@gw.example.com:913"})
Playwright wants the parts split out:
# ✅ correct
browser.new_context(proxy={
"server": "http://gw.example.com:913",
"username": "user",
"password": "pass",
})
This package does that conversion for you, and adds per-context rotation.
Usage
from playwright.sync_api import sync_playwright
from playwright_proxy_auth import ProxyPool
# A rotating residential gateway gives a new exit IP on every connection.
pool = ProxyPool(gateway="http://USERNAME:PASSWORD@us.jibaoproxy.com:913")
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
for _ in range(3):
context = browser.new_context(proxy=pool.get()) # fresh IP per context
page = context.new_page()
page.goto("https://httpbin.org/ip")
print(page.inner_text("body"))
context.close()
browser.close()
Static list instead of a gateway:
pool = ProxyPool(proxies=[
"http://USERNAME:PASSWORD@proxy-a.example.com:8000",
"http://USERNAME:PASSWORD@proxy-b.example.com:8000",
])
One-off conversion without the pool:
from playwright_proxy_auth import to_playwright_proxy
proxy = to_playwright_proxy("http://user:pass@gw.example.com:913")
browser.new_context(proxy=proxy)
See examples/ for the async version.
Gotchas this saves you from
- Credentials in the URL are ignored — they must be a separate
username/password. (Main reason for it.) - Authenticated SOCKS5 is not supported by Playwright. A
socks5://user:pass@…URL raises a clear error instead of failing silently — use an HTTP/HTTPS gateway for authenticated rotation. - Proxy is per context, not per page. Rotate by creating a new
browser.new_context(proxy=...); pages inside a context share its exit IP.
A note on getting blocked anyway
A correctly authenticated proxy still gets blocked if the exit IP is a datacenter range — anti-bot systems score the ASN and TLS/JA3 fingerprint before your page loads. Residential exits with clean ASN reputation are what pass. We build JiBao Proxy for this: 72M+ residential IPs across 200+ countries with sticky sessions. This package works with any HTTP proxy provider, though.
Related
- Selenium & Playwright proxy authentication, explained
- Why your JA3/TLS fingerprint gets you blocked
- browser-use & AI agent proxies
License
MIT
Metadata
Release files for playwright-proxy-authentication 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| playwright_proxy_authentication-0.1.0.tar.gz | 5.0 kB | Without provenance | Details for playwright_proxy_authentication-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| playwright_proxy_authentication-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for playwright_proxy_authentication-0.1.0-py3-none-any.whl |
Total release size: 10.5 kB
Release files / playwright_proxy_authentication-0.1.0.tar.gz
| Download URL | playwright_proxy_authentication-0.1.0.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
641e7a7f7c82c1096b7ce7da17c48ca240636546ceee57339c7e5c2bd22a2fb9
|
|
BLAKE2b-256 checksum How to use checksums |
adbad6d6d3d16e0ae6e95201db9e55e2bc08e5e4b1ccf97b5f869727a7d539c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / playwright_proxy_authentication-0.1.0-py3-none-any.whl
| Download URL | playwright_proxy_authentication-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
056c0ee108c867db7aa18b2c7791f0ea0944affff32cfb14f645acd9b2525893
|
|
BLAKE2b-256 checksum How to use checksums |
74973d44200ea99a191e0671f1828c4f2836adb6b699d69411c8e76193b15ecc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for playwright-proxy-authentication 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.