This example sends an HTTPS request through a proxy selected by the Proxy11 Python SDK. The SDK rotates your local candidate list; it does not guarantee that a public proxy is online or suitable for every destination.
pip install proxy11 requests
import os
import requests
from proxy11 import ProxyClient
client = ProxyClient(os.environ["PROXY11_API_KEY"])
session = client.session(country="us", proxy_type="anonymous")
try:
response = session.get("https://httpbin.org/ip", timeout=(5, 15))
except requests.exceptions.ProxyError:
# The failed proxy is removed from the pool; retry once with the next one.
response = session.get("https://httpbin.org/ip", timeout=(5, 15))
response.raise_for_status()
print(response.json())
The SDK selects an ip:port from a fetched list before each request. With auto-refresh enabled by client.session(), it fetches another batch when the current pool is exhausted. Requests already in progress are not moved to a different proxy.
The API's speed is the checker's observed response time, not a promise about your target site. Use bounded timeouts, handle proxy connection errors, and avoid sending passwords, payment data, or other sensitive information through public proxies.