By Rajesh Kannan, Co-Founder & CTO, Gramosoft · Last updated: · Code tested with Requests 2.34.2 on Python 3.13 against a local proxy lab on November 30, 2026
Free proxies work in Python Requests, but most of them are dead, slow, leaky or blocked by the time you use them. This guide shows how to test a free proxy list, rotate through the proxies that pass, and retry failures through a different proxy. It starts with the GcrawlAI route that needs no list at all, and every script was run against a local proxy lab.
TL;DR
- Use a proxy per request: pass
proxies={"http": p, "https": p}and a timeout on every call. Requests' docs warn thatsession.proxiescan be overwritten by environment variables. - Test before you use: in our lab, only 2 of 7 proxies passed. The rest were dead, too slow, blocked, leaking our IP or changing pages.
- Rotate with memory, retry elsewhere: a pool that cools down and retires bad proxies got 20 of 20 pages where random rotation got 10.
- GcrawlAI skips the list: each page loads through a rotating residential IP in a real browser, as one request, and failed requests are never charged.
How do you use free proxies in Python Requests? Pass the proxy per request with proxies={"http": proxy, "https": proxy} and a timeout. Test each proxy first for speed, IP leaks and changed content, keep only those that pass, rotate through them, and retry failures through a different proxy. Never send logins or keys through a free proxy.
| What goes wrong with free proxies | How you notice | What the code does |
|---|---|---|
| Dead or refusing connections | ProxyError, ConnectTimeout |
Checker drops it; the pool retires it after repeated failures |
| Too slow | ReadTimeout |
Timeout on every call, then retry through another proxy |
| Leaks your IP | Your IP in X-Forwarded-For or Via |
Checker rejects it before use |
| Changes the page | Different bytes from the direct copy | Checker compares a hash; the pool checks content |
| Blocked by the site | 403 | Pool retires it for that site |
| Rate limited | 429 with Retry-After | Pool cools it down for that long |
Skip the free proxy list with GcrawlAI
If you need pages rather than proxies, GcrawlAI removes the list, the checker and the retry loop. Each page loads in a real browser through a rotating residential IP in the country you choose, with stealth escalation when a bot check appears. Retries happen on GcrawlAI's side, one page is one request, and failed requests are never charged.
The script below fetches a static page and a JavaScript page from an Indian residential IP. There's no proxy string anywhere in it. Point base_url at your own server to run the same code on the self-hosted core.
# gcrawlai_fetch.py
# pip install gcrawl-sdk
"""No proxy list at all: each page loads in a real browser through a rotating residential IP in the
country you pick. Retries happen on GcrawlAI's side, and failed requests aren't charged."""
import os
from gcrawl_sdk import GcrawlClient, ScrapeOptions
gc = GcrawlClient(api_key=os.getenv("GCRAWL_API_KEY", "gc-YOUR_API_KEY"))
for url in ["https://books.toscrape.com/", "https://quotes.toscrape.com/js/"]:
page = gc.scrape(url, options=ScrapeOptions(html_enabled=True, markdown_enabled=True, proxy_geo="IN"), wait=True)
print(url, len(page.html or ""), "chars of HTML")
- Residential IPs in the country you pick: rotation, cooldown and retirement handled for you, so an exit the site has blocked isn't reused on your next page.
- Protected sites included: JavaScript rendering and handling for Cloudflare, DataDome, Akamai and PerimeterX come with every request.
- Use it as a fallback: keep free proxies for easy pages and send only the pages your pool can't fetch through GcrawlAI, as shown later in this guide.
- Scrape, crawl, map and search: single pages, whole sites, site maps and the Search API, with HTML, Markdown or screenshots back.
- How you connect: the managed Cloud API, the Python SDK, an MCP server for AI agents, the Playground and docs, or the MIT-licensed core on your servers.
- Billing: 50 free requests a month with no card, then $0.67 to $9.67 per 1,000 requests, with blocked pages, timeouts and server errors never billed.
Where it falls short: GcrawlAI gives you pages, not proxy addresses, so it isn't a fit if another tool needs a raw host:port. Free proxies cost nothing for small, unprotected jobs, which no paid service beats. The ecosystem is younger, and self-hosting the core means bringing your own proxy accounts.
"Free proxies are fine for learning and for small jobs on easy sites. The day you're writing a cooldown table for them, you're running proxy infrastructure, and that's a different project."
Rajesh Kannan, Co-Founder & CTO at Gramosoft
How to use a proxy in Python Requests
Requests sends a request through a proxy when you pass a proxies dictionary that maps each URL scheme to a proxy address. Pass it on every call, set a timeout, and check the exit IP once. Those three habits prevent most of the confusing failures people blame on free proxies.
# basic_proxy.py
# pip install requests (add requests[socks] for SOCKS proxies)
import requests
proxy = "http://203.0.113.10:8080" # from your free proxy list; SOCKS: "socks5h://203.0.113.10:1080"
r = requests.get(
"https://httpbin.org/ip",
proxies={"http": proxy, "https": proxy}, # per request: environment proxies can't override it
timeout=(4, 8), # 4 s to connect, 8 s to read; free proxies hang without one
)
print(r.json()) # should show the proxy's IP, not yours
- Per request, not per session: the Requests docs warn that
session.proxiesmay be overwritten by environment proxies such asHTTPS_PROXY. A script that rotates on one machine can silently use one proxy on another. - Both keys: the
httpskey decides the proxy for HTTPS URLs. Leave it out and HTTPS requests go direct, from your own IP. - Timeouts as a pair:
(connect, read). Without one, a dead free proxy can hang your script indefinitely. - SOCKS: install
requests[socks]and usesocks5h://so DNS lookups also go through the proxy instead of your own network.
For HTTPS URLs, Requests asks the proxy to open a tunnel and keeps TLS end to end, so the proxy sees the host name but not the page or your headers, as long as certificate checks stay on. Never set verify=False with a free proxy. Our guide to requests vs httpx vs aiohttp covers the same settings in the other clients.
Test free proxies before you use them
Most addresses on any free list fail at least one basic check. Test every proxy in parallel just before a job: does it connect, is it fast enough, does it hide your IP, does it admit to being a proxy, and does it return the page unchanged. Keep only the proxies that pass all five.
# check_proxies.py
# pip install requests
"""Test a free proxy list before you use it: alive, fast enough, not leaking your IP, not tampering.
Feed it ip:port lines (for example, saved from a free proxy list). Run it again before each job:
free proxies die within hours."""
import concurrent.futures as cf
import hashlib
import time
import requests
IP_URL = "https://httpbin.org/get" # echoes your origin IP and the headers it received
PAGE_URL = "http://httpbin.org/html" # a page to compare byte for byte (plain HTTP shows tampering)
LEAK_HEADERS = ("via", "x-forwarded-for", "forwarded", "x-real-ip", "client-ip")
def as_proxy(line):
line = line.strip()
return line if "://" in line else f"http://{line}" # use socks5h://host:port for SOCKS (pip install requests[socks])
def check_proxy(proxy, real_ip, page_hash, ip_url=IP_URL, page_url=PAGE_URL, timeout=(4, 6)):
p = {"http": proxy, "https": proxy} # per request, so environment proxies can't override it
out = {"proxy": proxy, "ok": False, "ms": None, "exit": None, "problem": None}
try:
t0 = time.perf_counter()
r = requests.get(ip_url, proxies=p, timeout=timeout)
out["ms"] = round((time.perf_counter() - t0) * 1000)
if r.status_code != 200:
out["problem"] = f"HTTP {r.status_code}"
return out
data = r.json()
out["exit"] = data.get("origin")
seen = {k.lower(): v for k, v in data.get("headers", {}).items()}
if real_ip in str(data.get("origin")) or any(real_ip in seen.get(h, "") for h in LEAK_HEADERS):
out["problem"] = "leaks your IP"
elif any(h in seen for h in LEAK_HEADERS):
out["problem"] = "reveals it is a proxy"
elif hashlib.sha256(requests.get(page_url, proxies=p, timeout=timeout).content).hexdigest() != page_hash:
out["problem"] = "changes page content"
else:
out["ok"] = True
except requests.exceptions.ProxyError:
out["problem"] = "proxy refused or dead"
except requests.exceptions.ConnectTimeout:
out["problem"] = "connect timeout"
except requests.exceptions.ReadTimeout:
out["problem"] = "too slow"
except (requests.exceptions.RequestException, ValueError) as e:
out["problem"] = type(e).__name__
return out
def check_all(lines, ip_url=IP_URL, page_url=PAGE_URL, workers=32):
direct = requests.get(ip_url, timeout=10).json()
real_ip = direct["origin"].split(",")[0].strip()
page_hash = hashlib.sha256(requests.get(page_url, timeout=10).content).hexdigest()
proxies = [as_proxy(l) for l in lines if l.strip()]
with cf.ThreadPoolExecutor(workers) as pool:
results = list(pool.map(lambda p: check_proxy(p, real_ip, page_hash, ip_url, page_url), proxies))
return sorted(results, key=lambda r: (not r["ok"], r["ms"] or 1e9))
if __name__ == "__main__":
lines = open("proxies.txt").read().splitlines()
results = check_all(lines)
for r in results:
print(f"{'PASS' if r['ok'] else 'fail'} {r['proxy']:<28} {str(r['ms'] or '-'):>6} ms {r['problem'] or ''}")
with open("working.txt", "w") as f:
f.writelines(r["proxy"] + "\n" for r in results if r["ok"])
print(sum(r["ok"] for r in results), "of", len(results), "passed -> working.txt")
The script fetches your real IP and a reference page directly first, then compares what each proxy returns. A transparent proxy adds your address in X-Forwarded-For or Via, which defeats the point. A tampering proxy injects scripts or ads into plain-HTTP pages, which is why the comparison uses an HTTP page and why your scraper should validate content too. Run the checker again before each job, because free proxies die within hours. Best Free Proxy Sites for Web Scraping in 2026 compares where to get lists.
Rotate free proxies with a pool that remembers
Picking a random proxy for each request isn't rotation; it's a lottery that keeps drawing the dead tickets. A pool needs memory: which proxies just failed, which are cooling down after a 429, and which a site has blocked. The class below tracks that state and always hands out the least recently used healthy proxy.
# proxy_pool.py
# pip install requests
"""Rotate and retry through a pool of free proxies with Python Requests.
The pool remembers what happened: a proxy that fails is cooled down, then retired after repeated
failures; a 429 cools it down for Retry-After; a 403 means this site has blocked it. Each retry goes
through a different proxy, with a short, jittered backoff."""
import random
import time
import requests
class PoolExhausted(Exception):
pass
class ProxyPool:
def __init__(self, proxies, cooldown=30, max_failures=3, clock=time.monotonic):
self.clock = clock
self.cooldown, self.max_failures = cooldown, max_failures
self.state = {p: {"failures": 0, "until": 0.0, "used": 0.0, "ok": 0, "bad": 0, "retired": False} for p in proxies}
def pick(self, exclude=()):
now = self.clock()
ready = [p for p, s in self.state.items() if not s["retired"] and s["until"] <= now and p not in exclude]
if not ready:
return None
proxy = min(ready, key=lambda p: self.state[p]["used"]) # least recently used spreads the load
self.state[proxy]["used"] = now
return proxy
def report(self, proxy, outcome, wait=None):
s = self.state[proxy]
if outcome == "ok":
s["ok"] += 1
s["failures"] = 0
return
s["bad"] += 1
if outcome == "rate_limited": # the site wants this exit to slow down, not leave
s["until"] = self.clock() + (wait or self.cooldown)
return
s["failures"] += 1
if outcome == "blocked" or s["failures"] >= self.max_failures:
s["retired"] = True # blocked by this site, or dead: stop spending requests on it
else:
s["until"] = self.clock() + self.cooldown * s["failures"]
def alive(self):
return sum(not s["retired"] for s in self.state.values())
def fetch(pool, url, attempts=4, timeout=(4, 6), check=None, session=requests):
"""GET url through the pool, retrying through a different proxy each time."""
tried = set()
for attempt in range(attempts):
proxy = pool.pick(exclude=tried)
if proxy is None:
break
tried.add(proxy)
try:
r = session.get(url, proxies={"http": proxy, "https": proxy}, timeout=timeout)
except (requests.exceptions.ProxyError, requests.exceptions.ConnectTimeout,
requests.exceptions.ReadTimeout, requests.exceptions.ConnectionError):
pool.report(proxy, "dead")
else:
if r.status_code == 429:
pool.report(proxy, "rate_limited", wait=float(r.headers.get("Retry-After", 30)))
elif r.status_code in (403, 407):
pool.report(proxy, "blocked")
elif r.status_code >= 500 or (check and r.status_code == 200 and not check(r)):
pool.report(proxy, "dead") # broken or tampered response: don't trust this proxy
else:
pool.report(proxy, "ok")
return r # 200, or the site's own answer such as 404
time.sleep(min(2.0, 0.25 * 2 ** attempt) * random.uniform(0.5, 1.0))
raise PoolExhausted(f"no proxy in the pool could fetch {url}")
if __name__ == "__main__":
pool = ProxyPool(open("working.txt").read().split())
r = fetch(pool, "https://httpbin.org/ip")
print(r.status_code, r.text.strip(), f"({pool.alive()} proxies alive)")
The rules are deliberately simple. A 429 cools the proxy down for the site's Retry-After, because the site wants that exit to slow down, not leave. A 403 retires it for this site, since a blocked IP rarely recovers within a job. A connection failure or a bad page cools it down for longer each time and retires it after three. A 404 is the site's real answer, so it's returned, not retried. Our residential vs datacenter proxies guide covers sticky sessions for logins and carts.
Retry the right failures, through a different proxy
A retry through the same dead proxy wastes time, and urllib3's built-in Retry on a session adapter does exactly that, because it retries the same connection settings. With free proxies, each retry should go through a different proxy, after a short, jittered pause, and only for failures a new proxy can fix.
| Response | Means | Retry through another proxy? |
|---|---|---|
ProxyError, ConnectTimeout, ReadTimeout |
The proxy failed | Yes |
| 403 or 407 | Site blocked this IP, or the proxy wants a login | Yes, and retire the proxy |
| 429 | Rate limited on this exit | Yes; cool it down for Retry-After |
| 5xx | Server or proxy error | Yes, after a pause |
| 200 with the wrong content | Tampered page or a block page | Yes; distrust the proxy |
| 404 or 410 | The page doesn't exist | No |
When every proxy is cooling down or retired, fetch() raises PoolExhausted. That's the point to stop and either wait or switch route. The function below keeps free proxies for the pages they can fetch and sends the rest through GcrawlAI:
# fallback_gcrawlai.py
# pip install gcrawl-sdk requests
"""Free proxies first; when the pool can't fetch a page, send that URL through GcrawlAI."""
import os
from gcrawl_sdk import GcrawlClient, ScrapeOptions
from proxy_pool import PoolExhausted, ProxyPool, fetch
gc = GcrawlClient(api_key=os.getenv("GCRAWL_API_KEY", "gc-YOUR_API_KEY"))
def get_html(pool, url, check, geo="US", client=gc):
try:
return fetch(pool, url, check=check).text, "free proxy"
except PoolExhausted:
page = client.scrape(url, options=ScrapeOptions(html_enabled=True, proxy_geo=geo), wait=True)
return page.html, "gcrawlai" # real browser, residential IP; failed requests aren't charged
if __name__ == "__main__":
pool = ProxyPool(open("working.txt").read().split())
html, route = get_html(pool, "https://books.toscrape.com/", check=lambda r: "product_pod" in r.text)
print(route, len(html or ""), "chars")
If the site keeps answering 429, slow down rather than adding proxies; our 429 Too Many Requests guide covers pacing. If every proxy gets 403, the site may be checking more than your IP, as fixing 403 Forbidden in Python Requests explains.
What happened when we ran it
We ran all three approaches against a local lab: a test site that rate-limits each IP to 4 requests per 10 seconds, and seven proxies that behave like a free list. Two were good, one slow, one leaky, one tampering, one blocked and one dead. Random rotation got 10 good pages out of 20; the pool got all 20.
# lab_output.txt (printed output)
1) Naive rotation: random proxy per request, no checks, 20 pages
{'ReadTimeout': 2, 'good page': 10, 'HTTP 403': 1, 'ProxyError': 1, 'tampered page': 3, 'HTTP 429': 3} in 12 s
2) Checker: 7 proxies tested in parallel
PASS http://127.0.0.1:8901 13 ms
PASS http://127.0.0.1:8902 15 ms
fail http://127.0.0.1:8906 11 ms HTTP 403
fail http://127.0.0.1:8904 15 ms leaks your IP
fail http://127.0.0.1:8905 16 ms changes page content
fail http://127.0.0.1:8903 - ms too slow
fail http://127.0.0.1:8907 - ms proxy refused or dead
2 of 7 passed
3) Pool with retries on the unchecked list: 20 pages
20 of 20 good pages in 25 s, 30 proxy attempts, 6 of 7 proxies still in the pool
good-1 ok=7 failed=1 in pool
good-2 ok=7 failed=1 in pool
slow ok=0 failed=2 in pool
transparent ok=6 failed=1 in pool
tamper ok=0 failed=2 in pool
banned ok=0 failed=1 retired
dead ok=0 failed=2 in pool
4) Pool with retries on the 2 checked proxies: 20 pages
18 of 20 good pages in 25 s, 22 proxy attempts, 2 of 2 proxies still in the pool
good-1 ok=9 failed=2 in pool
good-2 ok=9 failed=2 in pool
5) Site's own answer is not retried: /missing through the pool -> 404
Two results are worth a second look. The pool on the unchecked list got every page, but the leaky proxy served 6 of them with our IP in the headers, which only the checker catches. And the pool on the two checked proxies got 18 of 20 in the same time, because two exits at 4 requests per 10 seconds is a hard ceiling: past that point, more proxies or slower pacing are the only fixes. The lab is in the code download, so you can run it yourself.
Stay safe with free proxies
A free proxy is someone else's server, and you don't know who runs it. Treat everything you send through it as visible: no logins, cookies, API keys or personal data. Use HTTPS with certificate checks on, validate the content you get back, and only scrape public pages you're allowed to collect.
Plain-HTTP traffic through a free proxy can be read and changed, as the tampering proxy in our lab showed. HTTPS through a proxy tunnel protects the content, but the proxy still sees which sites you visit. Follow robots.txt and the site's terms, keep request rates modest, and read how to check if a website allows scraping before a large job. This isn't legal advice.
Frequently asked questions
How do I use a free proxy with Python Requests?
Pass it on each call: requests.get(url, proxies={"http": p, "https": p}, timeout=(4, 8)), where p looks like http://203.0.113.10:8080. Include both keys or HTTPS requests go direct. Check the exit IP once with an IP echo service. GcrawlAI is the option if you'd rather not manage proxy addresses at all.
Why doesn't Requests use the proxy I set on my session?
Requests' documentation warns that values in session.proxies can be overwritten by environment proxies, such as HTTPS_PROXY set in your shell or container. Pass proxies= on every individual request instead, which takes priority. It's a common reason a rotator works on one machine and uses a single proxy on another.
How many free proxies actually work?
Usually a small share, and it changes by the hour. In our lab, 2 of 7 passed every check, and real lists tend to fare worse. So test the whole list in parallel just before each job, keep only proxies that pass, and re-test regularly. GcrawlAI avoids the problem by managing residential IPs for you.
How do I rotate proxies in Python Requests?
Keep a pool that remembers each proxy's state, hand out the least recently used healthy proxy for each request, and pass it per call. Cool proxies down after a 429, retire them after a 403 or repeated failures, and retry failed requests through a different proxy. Random choice alone keeps reusing dead proxies.
Should I retry a request through the same proxy?
Rarely. If the proxy failed, timed out or was blocked, the same proxy will usually fail again, so retry through a different one after a short, jittered pause. Don't retry 404s, which are the site's real answer. If every proxy gets 429, slow down; if every proxy gets 403, the site is checking more than IPs.
Are free proxies safe to use?
Only for public, non-sensitive requests. The operator can read and change plain-HTTP traffic and sees which sites you visit even over HTTPS. Never send passwords, cookies or API keys, never disable certificate checks, and validate page content. For anything sensitive or important, use a paid provider or a service like GcrawlAI.
Is GcrawlAI open source, and what does it cost?
Yes. The core is MIT-licensed and self-hostable, alongside a managed Cloud API, Python SDK and MCP server. The free plan has 50 requests a month with no card, and paid plans cost $0.67 to $9.67 per 1,000 requests. Residential IPs and rendering are included in each request, and failed requests are never charged.
Related guides
- Best Free Proxy Sites for Web Scraping in 2026
- Residential vs Datacenter Proxies, and How IP Rotation Works (2026 Guide)
- 429 Too Many Requests: How to Fix It When Web Scraping
- How to Fix 403 Forbidden Errors in Python Requests (2026)
- Best Python HTTP Clients for Scraping: requests vs httpx vs aiohttp
- 10 Best User Agents for Web Scraping in 2026: Current Strings, Matching Headers and Rotation
- Web Scraping Without Getting Blocked: The 2026 Playbook
- How Websites Detect Scrapers: 13 Signals Anti-Bot Systems Check