Integration guides

Connecting a proxy to Playwright

Playwright is a tool for driving a browser with code. Put the gateway, username and token in the proxy option when you launch the browser, and every page request goes through ProxySup.

  • Connect with one gateway address
  • Set country and session in the username
  • Use your access token as the password

What you need to connect

Gateway
gate.proxysup.com:7777
Username
user-country-CODE
Password
Your account access token
Last updated
  • 1-line install
  • 4 steps to follow
  • Up to 30 min sticky sessions
  • HTTP, HTTPS, SOCKS5

Follow along

Playwright: steps to connect the proxy

Follow the steps from the top. Put your access token where it says YOUR_TOKEN.

  1. Step 1

    Install Playwright

    Terminal
    pip install playwright
    playwright install chromium
  2. Step 2

    Basic connection

    Code
    from playwright.sync_api import sync_playwright
    
    with sync_playwright() as p:
        browser = p.chromium.launch(proxy={
            "server": "http://gate.proxysup.com:7777",
            "username": "user-country-jp",
            "password": "YOUR_TOKEN",
        })
        page = browser.new_page()
        page.goto("https://ipinfo.io/json")
        print(page.text_content("body"))
        browser.close()
  3. Step 3

    Use a sticky session

    Part to change
    "username": "user-country-jp-city-osaka-session-a1b2"
    # Even if you reopen the browser, the same session name gets the same IP
  4. Step 4

    Check the connection

    Example response
    { "ip": "203.0.113.24",
      "country": "US",
      "org": "Home internet provider" }

Username

Username rules

Join values in the username to set the country, city, session and product.

ValueWhat it does
country-CODESets the country to connect from
city-CITYSets the city too. Only in countries with city targeting
session-NAMETurns on a sticky session. The same name gets the same IP
type-mobile or type-dcSwitches to mobile or datacenter proxies. Without it, residential is used

How the username fits together

userStartcountry-usCountrysession-a1b2Sticky session

Result user-country-us-session-a1b2

Troubleshooting

Playwright: fixing connection errors

  • I get a 407 error

    It means the username or token is wrong. Check that there are no spaces before or after the token and that the username starts with user-.

  • The connection times out

    Raise the timeout to about 30 seconds and lower the number of concurrent requests to the same site.

  • The same IP is not kept

    Check that the username has a session value. Sticky sessions last up to 30 minutes.

  • The city I want is not used

    Check on the locations page that the country has city targeting, and write the city name in lowercase English letters with underscores.

More

Other integration guides

  • Using a proxy with Python requests

    requests is one of the most used libraries for sending web requests in Python. Put the ProxySup gateway address in proxies and it connects right away.

    View guide
  • Connecting a proxy to Scrapy

    Scrapy is a Python tool for building crawlers that collect many pages. Put proxy in the request meta and every request goes through ProxySup.

    View guide

Connect Playwright right away

You get an access token as soon as you sign up. Top up your balance to use the code above as is.