In this Article
Python’s requests library is the simplest way to make HTTP calls — and adding a proxy is just one parameter. Whether you’re scraping, testing geo-restricted content, or building an API client that needs to look like a real user, you route requests through a proxy with the proxies= argument. This guide shows exactly how to use a proxy with Python requests (HTTP, HTTPS, authenticated, SOCKS5, sessions, env vars, and rotation), then ranks the 8 best proxies for Python requests in 2026. DataImpulse at $1/GB is the value baseline.
I’m Andrii Byzov, an AI-Native Fractional CMO who writes Python scrapers daily. Below: the copy-paste snippets, the SOCKS5 install + DNS-leak gotcha, and the providers worth your budget.
Key Facts
- Pass a
proxiesdict withhttpandhttpskeys:requests.get(url, proxies={"http": "...", "https": "..."}). - Credentials go in the proxy URL —
http://user:pass@host:port— no separate auth step needed. - Use a
Sessionto set the proxy once and reuse it (with connection pooling) across many requests. - SOCKS5 needs one install:
pip install "requests[socks]", then usesocks5h://(the h) so DNS resolves through the proxy and you don’t leak your real location. - DataImpulse is the value pick — residential $1/GB pay-as-you-go, datacenter $0.50/GB, mobile $2/GB, 90M+ IPs across 195 countries, HTTP/HTTPS/SOCKS5, country/city/ASN targeting.
How to Use a Proxy with Python Requests
1. Basic HTTP/HTTPS proxy with authentication
import requests
proxies = {
"http": "http://YOUR_LOGIN__cr.us:[email protected]:823",
"https": "http://YOUR_LOGIN__cr.us:[email protected]:823", # __cr.us = US
}
r = requests.get("https://httpbin.org/ip", proxies=proxies, timeout=30)
print(r.json()) # confirm the egress IP
Both keys point at the same proxy; credentials in the URL are used automatically. Always set a timeout. If your password contains special characters (@ : # /), URL-encode it with urllib.parse.quote() first.
2. A Session (set the proxy once, reuse it)
session = requests.Session()
session.proxies = proxies
session.get("https://example.com/page1")
session.get("https://example.com/page2") # same proxy, pooled connections
3. SOCKS5 (install once, avoid the DNS leak)
# pip install "requests[socks]"
proxies = {
"http": "socks5h://YOUR_LOGIN__cr.us:[email protected]:824",
"https": "socks5h://YOUR_LOGIN__cr.us:[email protected]:824",
}
requests.get("https://httpbin.org/ip", proxies=proxies, timeout=30)
Use socks5h (with the h) so hostnames resolve on the proxy side; plain socks5 resolves locally and can reveal your real location. DataImpulse exposes SOCKS5 on port 824.
4. Environment variables & rotation
# env vars (requests honors these automatically):
# export HTTPS_PROXY="http://YOUR_LOGIN__cr.us:[email protected]:823"
# rotation: with a rotating gateway each request already gets a fresh IP
for _ in range(5):
print(requests.get("https://httpbin.org/ip", proxies=proxies, timeout=30).json())
With DataImpulse’s rotating residential gateway, each request egresses from a new IP automatically — no proxy list to manage. To rotate a static list yourself, random.choice() a proxy per request.
Best Proxies for Python Requests at a Glance
| Provider | Best for requests | Residential price | Protocols | Notable |
|---|---|---|---|---|
| DataImpulse | Best value, scripts & scraping | $1/GB PAYG | HTTP/HTTPS/SOCKS5 | 90M+ pool, auth SOCKS5, never-expires |
| Bright Data | Enterprise + managed | ~$4/GB promo; $8 regular | HTTP/HTTPS/SOCKS5 | Web Unlocker, SERP API, datasets |
| Oxylabs | Enterprise SLA | from $6/GB | HTTP/HTTPS/SOCKS5 | 175M+ pool, scraper APIs |
| Decodo | Mid-market, full geo grid | $3.75/GB (~$2 at 1TB+) | HTTP/HTTPS/SOCKS5 | 115M+ pool, sticky to 24h |
| IPRoyal | Long sticky sessions | from $7.35/GB | HTTP/HTTPS/SOCKS5 | Sticky up to 7 days; cheap PAYG |
| SOAX | Residential + mobile mix | $3.60/GB Starter | HTTP/HTTPS/SOCKS5 | 155M+ res, 33M+ mobile |
| Webshare | Budget / self-serve | from $3.50/mo res; $2.99/mo DC | HTTP/SOCKS5 | Free tier, cheapest datacenter |
| NetNut | ISP-residential stability | from $3.53/GB | HTTP/HTTPS | Consumer-ISP static IPs |

The picks, briefly
DataImpulse is the value baseline for Python requests work — residential at $1/GB pay-as-you-go (datacenter $0.50/GB, mobile $2/GB), 90M+ IPs across 195 countries, HTTP/HTTPS and authenticated SOCKS5, with country/city/ASN targeting in the username. Traffic never expires, so dev runs don’t burn a subscription. Published success rate 99.51%; G2 4.8/5; 24/7 human support. For high-volume scraping with requests, it’s the lowest cost per successful request.
Bright Data is the enterprise pick (residential ~$8/GB regular, ~$4 promo) with Web Unlocker, SERP API, and datasets. Oxylabs (from $6/GB, 175M+ pool) is the SLA-grade option. Decodo (from $3.75/GB, sticky to 24h) is the balanced mid-market choice. IPRoyal (from $7.35/GB, sticky up to 7 days) suits long, session-stable scripts. SOAX ($3.60/GB, 155M+ residential + 33M+ mobile) adds a strong mobile pool. Webshare (free tier, datacenter from $2.99/mo) is the budget self-serve entry, and NetNut (from $3.53/GB) is the ISP-residential stability pick. All work with the proxies= argument.
Common Python Requests Proxy Mistakes
- Using
socks5://instead ofsocks5h://— plainsocks5resolves DNS locally and can leak your real location; usesocks5h. - Forgetting
pip install "requests[socks]"— without it, asocks5proxy URL raises a “Missing dependencies for SOCKS support” error. - No
timeout. A dead proxy can hang the request forever; always passtimeout=. - Using
verify=Falseto “fix” SSL errors — this hides man-in-the-middle risks; fix the real cause. - Datacenter IPs on defended targets — they get blocked fast; use residential for anti-bot-heavy sites and pair with realistic headers (User-Agent).
Rotating vs Sticky Proxies with Requests
For broad scraping, a rotating residential gateway is ideal — each request gets a fresh IP, so a simple loop spreads the scrape across the pool with no IP management. For stateful flows (login then follow-up calls), use a Session with a sticky proxy so the same IP and cookies persist across the sequence. Most requests scripts are stateless, so rotating is the common default.
Which Proxy Type for Python Requests — Residential, Datacenter, or Mobile?
- Residential ($1/GB) — the default for defended targets (e-commerce, SERPs, social). If you pick one, pick this.
- Mobile ($2/GB) — real carrier IPs for the hardest targets and mobile-web surfaces.
- Datacenter ($0.50/GB) — cheapest and fastest for unprotected work, APIs, and your own infrastructure; don’t point it at anti-bot-heavy sites.
DataImpulse offers all three on one pay-as-you-go account, so a single script can route each request to the right tier via the username and endpoint.
How to Start with DataImpulse + Python Requests
Step 1. Create a DataImpulse account and grab residential credentials. The $5 / 5GB intro never expires — a real test budget.
Step 2. Build the proxies dict with http://YOUR_LOGIN__cr.us:[email protected]:823, pass it to requests.get(..., proxies=proxies, timeout=30), and append a country code to the username for geo-targeting. Use socks5h://...:824 after pip install "requests[socks]" for SOCKS5.
Step 3. Use a Session for many calls, loop for rotation, and add realistic headers. See the DataImpulse tutorials and the residential proxies page.
FAQ
How do I use a proxy with Python requests?
Pass a proxies dict to your call: requests.get(url, proxies={"http": "http://user:pass@host:port", "https": "http://user:pass@host:port"}). Credentials in the URL are used automatically. For DataImpulse: http://YOUR_LOGIN__cr.us:[email protected]:823. Use a Session to reuse the proxy across requests.
Does Python requests support SOCKS5 proxies?
Yes, after installing the extra: pip install "requests[socks]". Then use a socks5h://user:pass@host:port URL in the proxies dict — authenticated SOCKS5 works. Always use socks5h (with the h) so DNS resolves through the proxy; plain socks5 resolves locally and can leak your location. DataImpulse exposes SOCKS5 on port 824.
What’s the best proxy for Python requests?
Residential proxies for defended targets — DataImpulse at $1/GB is the value pick (HTTP/HTTPS/SOCKS5, 90M+ IPs, authenticated SOCKS5, never-expiring traffic). Bright Data and Oxylabs are the enterprise options; Webshare is cheapest to start. All work with the proxies= argument; pair with realistic headers and a timeout.
How do I rotate proxies in Python requests?
Easiest: point the proxies dict at a rotating residential gateway (DataImpulse) — each request gets a fresh IP automatically. To rotate a static list, keep a list of proxy URLs and random.choice() one per request, or cycle through them. For stateful flows, hold one sticky proxy in a Session instead of rotating.
Why does my requests proxy raise “Missing dependencies for SOCKS support”?
You used a socks5 proxy URL without the SOCKS extra installed. Run pip install "requests[socks]" (it pulls in PySocks), then the socks5h:// URL works. For HTTP/HTTPS proxies no extra install is needed.
How much do Python requests proxies cost?
Raw residential is priced per GB — DataImpulse $1/GB (value floor), NetNut from $3.53, SOAX $3.60, Decodo $3.75, Oxylabs from $6, IPRoyal $7.35; Webshare offers budget subscriptions from $3.50/mo. A fetched page is a small fraction of a GB, so per-GB residential is far cheaper than per-record managed APIs for high-volume scraping; managed options suit the hardest targets.

State/City/Zip/ASN Targeting 



