All systems operational HTTP · HTTPS · SOCKS5 Global network
Documentation home Quickstart Engineering guides Code examples Global network Pricing Solutions overview Custom proxy pools Managed data scraping Contact Console
CODE EXAMPLE

Route Playwright browser traffic through LundProxy.

Route Playwright browser traffic through LundProxy. This example uses Rotating Proxies as the default gateway and can be adapted by replacing endpoint and routing credentials.

LanguagePython 3.11+FrameworkPlaywrightGatewayRotating ProxiesFilebrowser.py
01
SETUP

Install the client and create a file.

Use a clean project environment and pin tested dependency versions for production. The example target is a public scraping sandbox.

Installpython -m pip install playwright && playwright install chromium
02
CREDENTIALS

Load proxy secrets from the environment.

The proxy username is not the LundProxy website login. Copy the complete username and password generated for the selected proxy product.

PROXY_USER=user-pool-crawlerPROXY_PASS=your-secret
03
COMPLETE EXAMPLE

browser.py

Copy the code into the named file, set credentials, and run it from the project environment.

import asyncio
import os
from playwright.async_api import async_playwright


async def main():
    async with async_playwright() as playwright:
        browser = await playwright.chromium.launch(
            headless=True,
            proxy={
                "server": "http://proxy.lundproxy.com:36923",
                "username": os.environ["PROXY_USER"],
                "password": os.environ["PROXY_PASS"],
            },
        )
        context = await browser.new_context()
        page = await context.new_page()
        await page.goto(
            "https://quotes.toscrape.com/js/",
            wait_until="domcontentloaded",
            timeout=30_000,
        )
        print(await page.locator(".quote").count())
        await browser.close()


asyncio.run(main())
04
WHAT THE EXAMPLE DOES

Keep the important behavior visible.

01Proxy credentials are passed at browser launch.
02A navigation timeout is explicit.
03The browser is always closed.
04Browser concurrency should count subresource traffic.
05
PRODUCTION NOTES

Add workload-specific controls before scale.

A successful sandbox run proves integration, not production readiness.

Test representative targets, response sizes, routing policy, concurrency, retries, validation, and completion window. Collect only public data you are authorized to access.

06
EXAMPLE FAQ

Playwright questions.

Can the proxy change inside one browser context?

Treat proxy configuration as context or browser scoped. Create a new context or browser when the routing identity must change.

Why is traffic higher than an HTTP request?

The browser loads scripts, styles, images, fonts, and APIs.

How should I block unnecessary resources?

Use route handlers only when those resources are not required for page behavior or validation.