class proxyproviders.providers.brightdata.BrightData(api_key: str, zone: str, username_suffix: str | None = None, use_super_proxy: bool | None = True, config: ProxyConfig | None = None)[source]

Bases: ProxyProvider

BrightData (formerly luminati) is a proxy provider that offers residential and datacenter proxies.

Create an account here (affiliate link).

You can find your API key in the account settings here then create “add token” with scope “limit” (BrightData article for more info)

The BrightData API documentation is here

Parameters:
  • api_key – Your BrightData API key

  • zone – The zone ID/name to fetch proxies for (you can get this from the BrightData dashboard)

  • username_suffix – Optional suffix to append to the username more info allows you to target region, city, etc. (requires use_super_proxy=True)

  • use_super_proxy – Optional flag to use super proxy instead of targeting specific IPs, this is enabled by default. If you want to target specific IPs or have consistent IPs for a session, set this to False.

  • config – Configuration for the proxy provider. View the ProxyConfig class docs for more information.

Example:

from proxyproviders import BrightData

# Initialize the BrightData API client with an API key and a zone
proxy_provider = BrightData(api_key="your-api-key", zone="my_zone")

# Fetch proxies
proxies = proxy_provider.list_proxies() # returns one proxy for super proxy by default

# If you want to manage specific IPs
proxy_provider = BrightData(api_key="your-api-key", zone="my_zone", use_super_proxy=False)
proxies = proxy_provider.list_proxies() # returns multiple proxies for each IP in the zone (potentially thousands)
get_active_zones() Dict[source]

Fetches active zones from BrightData API.

Response:

[
    {
        "name": "zone1",
        "type": "dc",
    }
]
get_zone_username(zone: str) str[source]

Fetches zone username for the given zone ID from BrightData API.

Note: this isn’t directly an API endpoint, I’m sort of reconstructing some things here and it seems to behave a little weird.

Parameters:

zone – The zone ID to fetch username for

get_zone_passwords(zone: str) Dict[source]

Fetches zone passwords from BrightData API.

Parameters:

zone – The zone ID to fetch passwords for

Response:

{
    "passwords": [
        "password1",
        "password2",
    ]
}
list_all_ips_in_zone(zone: str, country: str | None = None) Dict[source]

Fetches all IPs in a zone from BrightData API.

Parameters:
  • zone – The zone ID to fetch IPs for

  • country – Optional 2-letter country code to filter IPs by

Response:

[
    {
        "ip": "192.168.1.1",
        "country": "US",
    }
]