Proxy Seller Guides

Using Proxy Seller Proxies with Python: requests, httpx, aiohttp and Scrapy

Working Python examples for Proxy Seller proxies: requests and httpx with HTTP and SOCKS5, rotating through a static list, residential sticky sessions, Scrapy middleware and error handling.

By Team of Monkeys Editorial Updated 3 min read Affiliate disclosure

This guide contains affiliate links to Geonode, Webshare, Rayobyte and Proxy Seller. If you buy through them we may earn a commission, at no extra cost to you.

Proxy Seller with Python illustration showing Python connecting through Proxy Seller to Website, covering requests, httpx, aiohttp 3jdej38j4

requests

python
import requests

proxy = "http://USERNAME:PASSWORD@HOST:PORT"
r = requests.get("https://api.ipify.org?format=json",
                 proxies={"http": proxy, "https": proxy}, timeout=20)
print(r.json())

For SOCKS5, install requests[socks] and use socks5h://USERNAME:PASSWORD@HOST:PORT so DNS goes through the proxy too. See our Python requests proxies guide for more.

Rotate through a static list

Proxy Seller IPv4, IPv6 and ISP proxies are static, so rotate in your code:

python
import itertools, requests

proxies = [line.strip() for line in open("proxies.txt") if line.strip()]  # host:port:user:pass
def to_url(p):
    host, port, user, pw = p.split(":")
    return f"http://{user}:{pw}@{host}:{port}"
pool = itertools.cycle(map(to_url, proxies))

for url in ["https://example.com/page1", "https://example.com/page2"]:
    p = next(pool)
    try:
        r = requests.get(url, proxies={"http": p, "https": p}, timeout=20)
        print(url, r.status_code)
    except requests.RequestException as e:
        print(url, "failed:", e)

Keep threads per IP low; static proxies allow 100 connections per IP by default under fair use, and far fewer is better for block rates.

Our editorial team, hard at work on your proxy questions (animated GIF) 3jdej38j4
Our editorial team, hard at work on your proxy questions. GIF via Tenor

httpx and async

python
import asyncio, httpx

async def main():
    async with httpx.AsyncClient(proxy="http://USERNAME:PASSWORD@HOST:PORT", timeout=20) as client:
        r = await client.get("https://api.ipify.org")
        print(r.text)

asyncio.run(main())

Coupon tip: Proxy Seller has no free trial, so the cheapest test is a one-week rental of a few IPs or 1 GB of residential traffic with code MONKEYS. Our our complete Proxy Seller guide explains which product fits which job.

Residential sessions

For residential, set rotation per list in the dashboard (per request, timed, or sticky up to 24 hours), then use the credentials for that list. Make one list per behaviour you need. See rotation and sticky sessions.

Residential tip: Rayobyte is worth testing when you need precise targeting: its residential proxies can be pinned to a country, state, city, ZIP code or ASN, with sticky sessions from 1 to 120 minutes. More in using Rayobyte with Python.

Scrapy

Set request.meta["proxy"] in a downloader middleware, picking from your list, or use a rotating proxy middleware package. Our Scrapy proxies guide has a full example.

Handle errors

  • 407: credentials or allowlist (see troubleshooting).
  • 429 from the proxy: too many connections on one IP.
  • Timeouts: retry with the next proxy and back off.

Proxy tip: If you're building a shortlist, add Geonode to it. It offers per-GB residential traffic that doesn't expire, unlimited residential plans, static ISP and rotating datacenter proxies, and scraping APIs. We look at where it fits in our Geonode proxies guide.

Retrying with the next proxy

python
import itertools, time, requests

def fetch(url, pool, tries=3):
    for attempt in range(tries):
        p = next(pool)
        try:
            r = requests.get(url, proxies={"http": p, "https": p}, timeout=20)
            if r.status_code == 200:
                return r
        except requests.RequestException:
            pass
        time.sleep(2 ** attempt)
    return None

Back off between attempts, and if one proxy keeps failing, drop it from the pool and check it with Proxy Seller's free tools.

How to use and rotate proxies with the Python Requests library, step by step. Video: ScrapeOps on YouTube

Before you buy, read our buy proxies guide for fair prices by type, check proxy coupons for current deals, and see the best proxies in 2026 for the wider market. For browser automation in depth, see our Puppeteer proxies guide.

Key takeaways

  • Use http://user:pass@host:port or socks5h:// URLs.
  • Rotate static lists in code; set residential rotation per list in the dashboard.
  • Keep concurrency per IP low and retry on the next proxy.

Budget tip: If you want a cheap proxy to try this with, Webshare has a free plan with 10 datacenter proxies and 1 GB of bandwidth a month, no card required. Paid lists let you pick proxy count, bandwidth and location. See using Webshare with Python.

FAQ

Do Proxy Seller proxies work with Python requests?

Yes, with HTTP or SOCKS5 proxy URLs.

How do I use SOCKS5 with Python requests?

Install requests[socks] and use a socks5h://user:pass@host:port proxy URL.

Sources and further reading

Independent references that back up the points above, from standards bodies, governments, universities and non-profits. They open in a new tab.

Affiliate disclosure: Team of Monkeys is an affiliate of Geonode, Webshare, Rayobyte and Proxy Seller. Links and banners marked as sponsored, and links to these four providers in the text, use our referral links, and we may earn a commission if you buy through them, at no extra cost to you. Our explanations and comparisons are written to be useful whichever provider you choose.

Editorial note: Proxy providers change their pools, features and prices often, so treat any figures here as typical ranges at the time of writing and confirm current terms with the provider before you buy.