Documentation has been updated: see help center and changelog in one place.

Geolocation targeting

Find out how to use the location parameters to access web data from specific locations.

You can specify a location for your Unblocking Browser session by adding the p_cc, p_city, or p_state parameter to your connection URL:

  • p_cc – selects the country, using 2 letter country code (e.g., US, DE, FR). If no country is specified, the system will automatically assign one based on availability.

  • p_city – selects the city written in lowercase (e.g., berlin, los_angeles, etc.). You must also specify either p_cc or p_state

  • p_state – selects a state (only for US) when used as a lowercase name (e.g., texas, ohio)

Here are the code samples for country targeting:

from playwright.sync_api import sync_playwright

username = "your-username"
password = "your-password"
endpoint = "ubc.oxylabs.io"
cc = "US"  # Replace with desired 2-letter country code
browser_url = f"wss://{username}:{password}@{endpoint}?p_cc={cc}"

with sync_playwright() as p:
    browser = p.chromium.connect_over_cdp(browser_url)
    page = browser.new_page()
    page.goto('https://example.com')
    browser.close()

Last updated

Was this helpful?