Integration · Python
Playwright
Browser-level proxy configuration, with resource blocking to control bandwidth.
Install
pip install playwright && playwright install chromiumExample
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(
proxy={"server": "http://GATEWAY_HOST:PORT", "username": "USERNAME", "password": "PASSWORD"}
)
page = browser.new_page()
page.route("**/*", lambda r: r.abort() if r.request.resource_type in {"image", "media", "font"} else r.continue_())
page.goto("https://httpbin.org/ip")
print(page.inner_text("body"))
browser.close()Replace USERNAME, PASSWORD, GATEWAY_HOST and PORT with the values in your dashboard. Never commit them.
Notes
- On per-GB products, blocking images, media and fonts is usually the largest single saving available.
Common errors
| 407 Proxy Authentication Required | Cause. Credentials missing, mistyped, or not URL-encoded. Fix. Percent-encode special characters in the username and password, or pass credentials separately from the URL where the client allows it. |
|---|---|
| Timeouts on first request | Cause. Wrong gateway host or port, or an outbound firewall rule on your side. Fix. Copy host and port from the dashboard entry for your product and test with curl first. |
Next: measure it on your real target.