### Setup ProxyShard API Examples Source: https://github.com/proxyshard/proxyshard-api-examples/blob/main/README.md Clone the repository, set up a virtual environment, install dependencies, configure your API token, and run the initial account check script. ```bash git clone https://github.com/ProxyShard/proxyshard-api-examples.git cd proxyshard-api-examples python -m venv .venv . .venv/bin/activate # Windows: .venv\Scripts\activate pip install -r requirements.txt cp .env.example .env # paste your PROXYSHARD_TOKEN into .env python 01_check_account.py ``` -------------------------------- ### Install SOCKS5 Support for Requests Source: https://github.com/proxyshard/proxyshard-api-examples/blob/main/README.md Install the necessary extra for the requests library to enable SOCKS5 proxy support. ```bash pip install "requests[socks]" ``` -------------------------------- ### Set up .env file for API token Source: https://github.com/proxyshard/proxyshard-api-examples/blob/main/README.md Copy the example .env file and paste your API token into it. This file is used to store sensitive credentials. ```bash cp .env.example .env # edit .env and paste the token ``` -------------------------------- ### Example Residential Proxy URL Source: https://github.com/proxyshard/proxyshard-api-examples/blob/main/README.md A concrete example of a residential proxy URL, illustrating the format with specific values for scheme, username, password, host, and port. ```text http://plan-premium-country-de-region-berlin-sid-abc12345:eu5ymcyjcxmxsmc9@relay-eu.proxyshard.com:8080 ``` -------------------------------- ### Build Residential Username with Rotating IP Source: https://github.com/proxyshard/proxyshard-api-examples/blob/main/README.md Use this function to get a new exit IP address for each request by setting sticky to False. ```python # Rotating: new IP every request build_residential_username("premium", country="de", sticky=False) ``` -------------------------------- ### Build Residential Username with Random Country Source: https://github.com/proxyshard/proxyshard-api-examples/blob/main/README.md Use this function to load balance across the entire proxy pool by specifying country as 'any'. ```python build_residential_username("premium", country="any") ``` -------------------------------- ### Plug Proxy into Requests Library Source: https://github.com/proxyshard/proxyshard-api-examples/blob/main/README.md Configure the 'proxies' dictionary with your generated proxy URL to use it with the requests library for HTTP and HTTPS requests. ```python proxies = {"http": proxy_url, "https": proxy_url} requests.get("https://api.ipify.org?format=json", proxies=proxies, timeout=15) ``` -------------------------------- ### Build Residential Username with Sticky Session Source: https://github.com/proxyshard/proxyshard-api-examples/blob/main/README.md Use this function to maintain the same exit IP address across multiple requests by providing a session ID. ```python # Same sid → same exit IP across requests build_residential_username("premium", country="de", sid="my-stable-session") ``` -------------------------------- ### Resolve Relay IP for Direct Use Source: https://github.com/proxyshard/proxyshard-api-examples/blob/main/README.md Resolve the domain name to an IP address once and use it for proxying if your environment has DNS resolution issues or to reduce lookup time. Remember to re-resolve periodically as IPs can change. ```python import socket ip = socket.gethostbyname("relay-eu.proxyshard.com") proxy_url = f"http://{username}:{password}@{ip}:8080" ``` -------------------------------- ### Build SOCKS5 Proxy URL Source: https://github.com/proxyshard/proxyshard-api-examples/blob/main/README.md Generate a proxy URL specifically for SOCKS5 protocol, which typically uses port 1080. ```python proxy_url = build_proxy_url(username, password, scheme="socks5") # uses port 1080 ``` -------------------------------- ### Residential Proxy URL Format Source: https://github.com/proxyshard/proxyshard-api-examples/blob/main/README.md The standard format for constructing a residential proxy URL. This format is used client-side as there is no dedicated API endpoint for generating proxies. ```text scheme://USERNAME:PASSWORD@HOST:PORT ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.