Python and Node.js · setup guide

Playwright proxy setup

Playwright takes the proxy as an object with server, username and password, at launch or per browser context. That second option is the useful one: several contexts in one browser, each on its own IP, each with its own cookies.
You will need

Residentialresi.proxymonkey.io:8000

ISP or datacenterIP:PORT

CredentialsUSER:PASS

Copy your own from the dashboard, which also lists the host and port for every order. Where it differs from this page, the dashboard is right.

Install

The Python package, then the browser it drives. The Node.js API takes the same proxy object.

terminal
pip install playwright && playwright install chromium

Rotating residential

Credentials go in their own fields, and server holds only the scheme, host and port. Launch-level proxy settings apply to every page the browser opens.

rotate.py
from playwright.sync_api import sync_playwright

PROXY = {
    "server": "http://resi.proxymonkey.io:8000",
    "username": "USER",
    "password": "PASS",
}

with sync_playwright() as p:
    browser = p.chromium.launch(proxy=PROXY)
    page = browser.new_page()
    page.goto("https://httpbin.org/ip")
    print(page.inner_text("body"))
    browser.close()

A static datacenter or ISP IP

Give each context its own proxy. Here one context runs on the static datacenter IP; a second could use an ISP order with the host and port from your dashboard. Contexts do not share cookies or storage, so they look like separate visitors.

contexts.py
from playwright.sync_api import sync_playwright

DATACENTER = {
    "server": "http://IP:PORT",
    "username": "USER",
    "password": "PASS",
}

with sync_playwright() as p:
    browser = p.chromium.launch()
    context = browser.new_context(proxy=DATACENTER)
    page = context.new_page()
    page.goto("https://httpbin.org/ip")
    print(page.inner_text("body"))
    context.close()
    browser.close()

Keeping one identity

One page load is dozens of requests: HTML, scripts, fonts, API calls. On the rotating gateway those can leave from different addresses, and some sites notice a visitor whose IP changes between the page and its scripts. For browser work that logs in or clicks through several pages, use a static datacenter or ISP IP per context, or a residential sticky session; the session setting for your account is in the dashboard.

Specific to Playwright

Things worth knowing

Block what you do not need

Images, video and fonts are most of a page's weight, and we meter request plus response bytes for every one of them. If you only need the text, abort them.

block.py
SKIP = {"image", "media", "font"}

page.route(
    "**/*",
    lambda route: route.abort()
    if route.request.resource_type in SKIP
    else route.continue_(),
)

Wait for less

The default goto waits for the load event, which on an ad-heavy page can take a long time over a residential exit. wait_until="domcontentloaded" is often enough, followed by waiting for the one selector you want.

Per-context proxies on older versions

Old Playwright releases on Windows needed a placeholder proxy at launch before per-context proxies would apply. If a context proxy seems ignored, upgrade before you debug anything else.

When it breaks

Common errors and fixes

  • The page loads as a 407, or navigation fails with an auth error

    Why
    Wrong credentials in the fields, or credentials written into the server string where they do not belong.
    Fix
    Move them into username and password and keep server to scheme, host and port.
  • net::ERR_PROXY_CONNECTION_FAILED

    Why
    The browser could not reach the gateway: a typo in host or port, or a firewall blocking outbound connections to it.
    Fix
    Test the same host and port with curl from the same machine.
  • TimeoutError: page.goto: Timeout 30000ms exceeded

    Why
    The default 30-second navigation timeout, waiting for load on a heavy page through a slow exit.
    Fix
    Use wait_until="domcontentloaded", block heavy resources, and raise the limit with page.set_default_navigation_timeout if you must.
  • net::ERR_CERT_AUTHORITY_INVALID

    Why
    The target's certificate. TLS runs through the tunnel untouched.
    Fix
    ignore_https_errors=True on the context is for testing only.

A failed connection that moved no data is not billed. Retries you send are billed like any other request, and each shows as its own line in your usage log.

The community layer

Playwright still misbehaving?

Paste the error and the few lines that set up the proxy into Discord, with the password taken out. Someone there has seen it before.

Join the Discord

4,200+monkeys in the Discord

  • Help from humans

    Post your error, get an answer. Usually in minutes, usually from someone who has hit the same wall.

  • A status bot that tells on us

    Pool health, incidents and maintenance posted automatically. Including the bad days.

  • Deals and free traffic

    Bonus GB drops, early access to new pools, and the occasional giveaway for a good bug report.

Join the Discord4,200+ monkeys, free to lurk