Rotate Residential Proxies in Python: Authorised Testing

    Configure Python proxy clients for authorised tests. Plan sessions, protect credentials and stop when a destination refuses access.

    Capa do post “Rotate Residential Proxies in Python: Authorised Testing”, categoria Scraping, com identidade visual RH7.

    Authorized access and responsible testing

    Use owned or authorized resources and documented APIs when available. Confirm source conditions before collecting. Stop on access denial or verification requests, honor rate limits and use official review channels instead of changing identity to continue. Record location, time, permitted scope and data usage.

    Setup with RH7

    Your RH7 credentials work with any standard HTTP library. The format is:

    host: auto-rh7proxys.com
    port: 823
    user: your-username
    password: your-password
    

    1. Simple rotation with requests

    import requests
    
    PROXY = "http://USER:PASS@auto-rh7proxys.com:823"
    proxies = {"http": PROXY, "https": PROXY}
    
    resp = requests.get("https://httpbin.org/ip", proxies=proxies, timeout=15)
    print(resp.json())
    

    Each request with RH7 already comes with a rotated IP by default.

    {{STICKY_CALLOUT}}

    2. Sticky (FIXED IP) - same permanent IP

    For flows that need to maintain a session (login, shopping cart, account), use a dedicated port from the sticky range (10000, 10000+1, 10000+2…). Each port equals 1 permanent fixed residential IP:

    PROXY_ACCOUNT_1 = "http://USER-session-account1:PASS@auto-rh7proxys.com:10000"## Account 2 → port 10001 (FIXED IP "B")
    PROXY_ACCOUNT_2 = "http://USER-session-account2:PASS@auto-rh7proxys.com:10001"
    

    Keep the configured session for an authorized test flow when continuity is required. Record the port, observed IP and session duration. Different ports do not establish different people or guarantee exclusive addresses; never use them to hide account ownership or continue after an access refusal.

    3. Async with httpx + exponential retry

    import httpx, asyncio, random
    
    async def fetch(url):
        for attempt in range(3):
            try:
                async with httpx.AsyncClient(proxy=PROXY, timeout=20) as c:
                    r = await c.get(url)
                    if r.status_code == 200:
                        return r.text
            except Exception:
                await asyncio.sleep(2 ** attempt + random.random())
        return None
    

    4. Pool with aiohttp

    For high volume (thousands of req/min), aiohttp + connector is more efficient:

    import aiohttp, asyncio
    
    connector = aiohttp.TCPConnector(limit=100)
    async with aiohttp.ClientSession(connector=connector) as s:
        async with s.get("https://target.com", proxy=PROXY) as r:
            data = await r.text()
    

    Authorized access and responsible testing

    Use owned or authorized resources and documented APIs when available. Confirm source conditions before collecting. Stop on access denial or verification requests, honor rate limits and use official review channels instead of changing identity to continue. Record location, time, permitted scope and data usage.

    Authorized access and responsible testing

    Use owned or authorized resources and documented APIs when available. Confirm source conditions before collecting. Stop on access denial or verification requests, honor rate limits and use official review channels instead of changing identity to continue. Record location, time, permitted scope and data usage.

    Conclusion

    Configured rotation can support permitted research and authorized regional QA. Measure latency, bandwidth and response codes in your own sample rather than assuming a universal success rate. Honor source limits and stop on denial or verification requests; a proxy does not grant access rights.

    Authorized access and responsible testing

    Use owned or authorized resources and documented APIs when available. Confirm source conditions before collecting. Stop on access denial or verification requests, honor rate limits and use official review channels instead of changing identity to continue. Record location, time, permitted scope and data usage.

    Published 2026-04-15 · RH7 Proxys editorial team

    Current prices for a 10 GB purchase

    USD totals include the 3.5% payment fee. Location and session availability must be checked before scaling.

    ProductPrice / GB10 GB totalBuy
    Rotating residentialUS$1.45US$14.49Buy
    Residential sticky sessionsUS$1.45US$14.49Buy
    MobileUS$2.52US$25.21Buy
    Residential IPv4 stickyUS$1.81US$18.12Buy

    Use only authorised sources and respect destination policies. Read our acceptable-use rules and refund conditions.