The short answer
Scrapy works well with both providers, and the projects that get the best results usually use both. Webshare is the cheaper way to push high volumes through lenient sites, because its datacenter proxies come as lists you can rotate yourself at a flat price. Geonode is the stronger choice for the protected minority of domains, through rotating residential gateways with country targeting and bandwidth that doesn't expire.
| Your crawl | Better fit | Why |
|---|---|---|
| Millions of pages from lenient sites | Webshare datacenter list | Flat pricing, per-IP control in a middleware |
| Protected sites that block datacenter IPs | Geonode rotating residential | Residential trust, rotation handled by the gateway |
| Country-specific content | Either, with country targeting | Both support country targeting; Geonode adds city and ASN |
| Quarterly or spiky crawls | Geonode residential | Bandwidth doesn't expire between runs |
| Logged-in or paginated paths | Either, with sticky sessions | Pin one IP per crawl path |
| A mix of all of the above | Both, routed per domain | Cheap bulk, trusted exits where needed |
The rest of this guide shows how to wire both into one Scrapy project and how to decide, with data, which domain goes where.
How Scrapy handles proxies
Scrapy's built-in HttpProxyMiddleware reads each request's proxy from request.meta["proxy"]. Put the credentials in the URL, for example http://user:pass@host:port, and the middleware turns them into a Proxy-Authorization header for you. HTTPS targets go through the proxy with a CONNECT tunnel, so the proxy URL itself stays http://.
Four details save debugging time:
- Set the proxy per request, not globally. Environment variables like
HTTPS_PROXYwork for a quick test, but per-requestmetais what makes routing, rotation and retries possible. - Keep credentials in the proxy URL. Since Scrapy 2.6.2, the middleware strips the
Proxy-Authorizationheader when a request's proxy changes, to avoid leaking credentials to the wrong proxy. If you set that header by hand, it can silently disappear on retries. - No native SOCKS support. Use the HTTP endpoints both providers offer. If a source only offers SOCKS5, run a local HTTP to SOCKS converter.
- Your router must run before the built-in middleware.
HttpProxyMiddlewaresits at priority 750, so give your own proxy middleware a lower number, such as 350.

How each provider looks to Scrapy
| Webshare | Geonode | |
|---|---|---|
| Gateway (provider rotates) | Backbone at p.webshare.io:80, with -rotate or a session number in the username | Rotating residential and datacenter gateways from the dashboard's endpoint generator |
| List (you rotate) | Datacenter and static residential lists, downloadable from the API | ISP proxy lists |
| Targeting | Country, plus ASN on residential | Country, state, city and ASN on residential |
| Sticky sessions | Session number in the username | Sticky session endpoints, up to 24 hours |
| Billing that matters for crawls | Flat per-IP plans with thread limits for lists; per-GB residential | Per-GB residential that doesn't expire; unmetered ISP |
A list in your own middleware gives per-IP control: you choose which IP each request uses, you can retire a blocked IP and you can throttle per IP. A gateway is simpler: one URL, a large pool and rotation handled for you. Most projects use lists for bulk and gateways for hard targets.
Loading a Webshare list from the API
Hard-coding IPs breaks as soon as Webshare replaces one. Load the list when the spider starts instead:
# proxies.py
import os
import requests
def webshare_list():
"""Return Webshare direct proxies as http://user:pass@ip:port URLs."""
head = {"Authorization": f"Token {os.environ['WEBSHARE_API_KEY']}"}
url = "https://proxy.webshare.io/api/v2/proxy/list/?mode=direct&page_size=100"
out = []
while url:
data = requests.get(url, headers=head, timeout=30).json()
out += [f"http://{p['username']}:{p['password']}@{p['proxy_address']}:{p['port']}"
for p in data["results"] if p.get("valid", True)]
url = data.get("next")
return outFor the Geonode side, generate a rotating residential endpoint in the dashboard and keep it in an environment variable. Country targeting is added to the username, following the -country-de pattern in Geonode's documentation; use the exact format your dashboard shows.
A routing middleware for two providers
This middleware sends hard domains to Geonode residential and everything else to the Webshare list, records which provider served each response, and has a switch for incidents.
# middlewares.py
import os
import random
from urllib.parse import urlparse
from .proxies import webshare_list
class ProviderRouter:
def __init__(self, crawler):
s = crawler.settings
self.stats = crawler.stats
self.dc = webshare_list()
self.res = os.environ["GEONODE_RES_URL"] # http://user:pass@host:port
self.hard = set(s.getlist("HARD_DOMAINS"))
self.force = s.get("FORCE_PROVIDER") # "webshare", "geonode" or None
@classmethod
def from_crawler(cls, crawler):
return cls(crawler)
def pick(self, host):
if self.force == "geonode" or (self.force is None and host in self.hard):
return "geonode", self.res
return "webshare", random.choice(self.dc)
def process_request(self, request, spider):
if "proxy" in request.meta:
return None # keep sticky or hand-set proxies
provider, proxy = self.pick(urlparse(request.url).hostname)
request.meta["proxy"] = proxy
request.meta["provider"] = provider
return None
def process_response(self, request, response, spider):
p = request.meta.get("provider", "none")
self.stats.inc_value(f"provider/{p}/{response.status}")
return response# settings.py
HARD_DOMAINS = ["bigshop.example", "travel.example"]
FORCE_PROVIDER = None
DOWNLOADER_MIDDLEWARES = {
"myproject.middlewares.ProviderRouter": 350,
"myproject.middlewares.BlockedRetry": 360,
}Start with your best guess for HARD_DOMAINS, then let the stats decide. If a "hard" domain shows a 98% success rate on Webshare in a test run, move it back to the cheaper side.
Retries that actually change the IP
Two Scrapy behaviours surprise people:
- 429 is already retried by default.
RETRY_HTTP_CODESincludes 429 along with 5xx codes and 408. 403 isn't included, because on most sites a 403 is a block, not a hiccup. - A retried request keeps its
meta, including the proxy. On a Webshare list, the retry goes out through the same IP that was just blocked.
On a rotating gateway, every new connection gets a new IP, so plain retries are fine. On a list, drop the proxy before retrying so the router picks another one:
# middlewares.py
from scrapy.downloadermiddlewares.retry import get_retry_request
class BlockedRetry:
def process_response(self, request, response, spider):
if response.status in (403, 429):
retry = get_retry_request(request, spider=spider, reason=f"blocked_{response.status}")
if retry is not None:
if not retry.meta.get("sticky"):
retry.meta.pop("proxy", None) # the router assigns a different exit
return retry
return responseKeep RETRY_TIMES low (two or three). If a domain blocks the same request three times from three different IPs, more retries only burn bandwidth; the fix is a different proxy type, slower crawling or better headers.
Proxy tip: To test the Geonode side of this comparison, a small residential balance from Geonode is enough, and it doesn't expire if you pause. See using Geonode with Scrapy for its full product range.
Sticky crawls for pagination and logins
Some paths need one identity from start to finish: a login followed by account pages, a search with session-bound pagination, or a cart. Pin a session for the whole path and pair it with Scrapy's cookiejar key so cookies and IP stay together.
def start_requests(self):
for n, url in enumerate(self.start_urls):
session = f"http://{os.environ['WS_USER']}-{n + 1}:{os.environ['WS_PASS']}@p.webshare.io:80"
yield scrapy.Request(url, meta={"proxy": session, "sticky": True, "cookiejar": n})
def parse(self, response):
for href in response.css("a.next::attr(href)").getall():
yield response.follow(href, meta={k: response.meta[k] for k in ("proxy", "sticky", "cookiejar")})On Geonode, use a sticky session endpoint from the dashboard with a lifetime that comfortably covers the path. Because the router skips requests that already carry a proxy, sticky requests pass through untouched.
JavaScript-heavy sites with scrapy-playwright
When a site needs a real browser, scrapy-playwright renders pages inside Scrapy. Proxies are set per browser context, not per request, so define one context per provider and choose the context in meta:
# settings.py (with scrapy-playwright installed and its download handlers enabled)
import os
PLAYWRIGHT_CONTEXTS = {
"webshare": {"proxy": {"server": "http://p.webshare.io:80",
"username": os.environ["WS_USER"] + "-rotate",
"password": os.environ["WS_PASS"]}},
"geonode": {"proxy": {"server": f"http://{os.environ['GEONODE_HOST']}:{os.environ['GEONODE_PORT']}",
"username": os.environ["GEONODE_USER"],
"password": os.environ["GEONODE_PASS"]}},
}
# in the spider
yield scrapy.Request(url, meta={"playwright": True, "playwright_context": "geonode"})Browser pages are much heavier than HTML responses, so block images, fonts and media where you can. On per-GB residential traffic, that's often the biggest single saving in the project.
Throttling, concurrency and thread limits
Scrapy throttles per download slot, and by default there's one slot per domain. That's what you want for politeness: CONCURRENT_REQUESTS_PER_DOMAIN limits how hard you hit each site, whichever proxy carries the request.
CONCURRENT_REQUESTS = 64
CONCURRENT_REQUESTS_PER_DOMAIN = 8
AUTOTHROTTLE_ENABLED = True
AUTOTHROTTLE_TARGET_CONCURRENCY = 4.0
DOWNLOAD_TIMEOUT = 30
RETRY_TIMES = 2Two provider-specific limits sit on top of that:
- Webshare thread limits. Webshare plans cap simultaneous connections. Keep
CONCURRENT_REQUESTSfor the Webshare share of traffic below your plan's limit, or you'll see connection errors that look like blocks. - Residential ramp-up on Geonode. Start with modest concurrency on residential gateways and raise it while watching the error rate per domain. A sudden rise in 403s or timeouts means you've passed the site's comfort level, not the provider's.
For background on why sites push back, see rate limiting and proxies.
Geo-targeted crawls
Prices, availability and search results often differ by country. Both providers let you choose the exit country in the username, so you can crawl the same URL as a visitor from several markets by building one proxy URL per country and passing it in meta.
Use Webshare's country targeting for broad country coverage at a low price on datacenter IPs, and Geonode residential when the site checks IP type as well as location, or when you need city or ASN precision. Always verify the exit location at the start of a crawl, because a crawl that silently runs from the wrong country produces data that looks plausible and is wrong.
Cost at crawl scale: a worked example
Cost per item is the number that matters, not price per IP or per GB. A simple way to estimate it:
- Measure the average response size per domain from a test crawl (Scrapy's
downloader/response_bytesstat divided by the response count). - Multiply by pages per month to get bandwidth.
- Price the bandwidth on residential, or the IP count on a list, and divide by successful items.
| Crawl | Pages per month | Average page | Monthly traffic | Cheaper setup |
|---|---|---|---|---|
| Lenient catalogs | 10,000,000 | 80 KB | about 800 GB | Webshare datacenter list (flat per IP) |
| Protected retailer | 500,000 | 150 KB | about 75 GB | Geonode residential |
| Same retailer through a browser | 500,000 | 1.5 MB | about 750 GB | Fix the browser first: block assets, find the JSON endpoint |
| Quarterly market study | 2,000,000 once a quarter | 100 KB | about 200 GB per run | Geonode residential, bandwidth carries over |
The third row is the usual budget trap. Before paying for more residential traffic, check whether the data you need is in an API response the page calls, which is often a fraction of the page's size.
Budget tip: The cheapest way to settle this comparison is to test both: Webshare has a free datacenter plan, and Geonode offers a low-cost residential trial. Run the same targets through each. See using Webshare with Scrapy.
Reporting and handling an outage
With the router above, Scrapy's end-of-crawl stats show lines such as provider/webshare/200 and provider/geonode/403. Export them after every run and compare success rate and cost per item per provider and per domain. A weekly report that flags domains whose block rate rose is enough to keep routing tuned.
If one provider starts failing across every domain, it's an outage rather than a block. Set FORCE_PROVIDER = "geonode" (or "webshare") and redeploy, or pass it at run time with -s FORCE_PROVIDER=geonode. Switch back when the provider's status page clears.
A real-world example
A pricing team runs 40 Scrapy spiders against competitor catalogs. A shared ProviderRouter reads domain routes from a YAML file. In the first month, 34 spiders' domains run on a Webshare datacenter list, and six run on Geonode residential, two of them through scrapy-playwright with assets blocked and cookiejar sessions for pagination.
After four weeks, the stats show one Webshare domain's 403 rate climbing from 1% to 15%. A one-day test on Geonode residential brings it back under 2%, and the extra residential traffic costs less than the lost data, so the route moves. One of the six "hard" domains turns out to work at 99% on Webshare, so it moves the other way. Net cost per item drops by about a fifth, with no change to the spiders themselves.
Which should you choose?
- Only lenient targets? Start with Webshare datacenter lists and a rotating middleware.
- Mostly protected targets? Start with Geonode residential and keep requests lean.
- A mix, or you don't know yet? Use both with a routing middleware, and let a month of stats decide which domain goes where.
For a wider comparison of the two providers across scraping jobs, see Webshare vs Geonode for web scraping. For single-provider setup, see Webshare with Scrapy and Geonode with Scrapy, and for how proxy types compare across every job, our best proxies guide.
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 Scrapy.
Key takeaways
- Scrapy reads
meta["proxy"], so a routing middleware can send each domain to either provider. - Webshare datacenter lists are the cheap bulk option; Geonode residential handles protected domains.
- Retries keep the old proxy unless you clear it, and 403 isn't retried by default.
- Pin sticky sessions and
cookiejartogether for paginated or logged-in paths. - Measure cost per item per domain, and let the stats move domains between providers.
FAQ
Can one Scrapy project use two proxy providers?
Yes. Set meta["proxy"] per request in a downloader middleware, based on the domain, the job or a setting, and the built-in HttpProxyMiddleware handles authentication for either provider.
Does Scrapy support SOCKS5 proxies?
Not natively. Use the HTTP endpoints Webshare and Geonode provide, or run a local HTTP to SOCKS converter if a source only offers SOCKS5.
Which is cheaper for large Scrapy crawls?
For lenient targets, Webshare datacenter lists, because the price doesn't grow with bandwidth. For protected targets, Geonode residential usually costs less per successful item, because far fewer requests are blocked.
Why do my Scrapy retries keep using the same blocked IP?
Retried requests copy the original request's meta, including the proxy. Clear meta["proxy"] in the retry (as in the BlockedRetry example) so your middleware assigns a new one.
Does Scrapy retry 403 responses?
Not by default. The default RETRY_HTTP_CODES includes 429, 408 and several 5xx codes. Add 403 only if you also change the IP on retry, otherwise you repeat the block.
How do I use proxies with scrapy-playwright?
Define a browser context per provider in PLAYWRIGHT_CONTEXTS with a proxy setting, then choose it per request with the playwright_context meta key.
How do I test a provider for one spider only?
Override that spider's routes with custom_settings (for example its own HARD_DOMAINS or FORCE_PROVIDER) and compare the provider stats from a few runs.
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.
- Downloader Middleware (Scrapy documentation): Scrapy's documentation for the middleware where proxy rotation lives.
- Bandwidth (computing) (Wikipedia): What bandwidth means, the unit most residential proxies are priced by.
- How It Works (Let's Encrypt): How HTTPS certificates are issued, the reason HTTPS proxies cannot read your traffic.
- CONNECT request method (MDN Web Docs (Mozilla)): How browsers open an HTTPS tunnel through an HTTP proxy.
- RFC 9293: Transmission Control Protocol (TCP) (IETF / RFC Editor): The current TCP specification, the transport under HTTP and SOCKS proxies.
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.