How to use proxies for web scraping

Alex ReznikovGonzoProxy blog author

Proxy setup · Published · Updated · 5 min read · 1,100 views

Try for $1.99 Try 300 MB of residential traffic. It never expires.

Contents 13 sections
  1. When a scraper needs proxies
  2. Which proxy type to take
  3. Rotating IP or sticky session
  4. Requests
  5. Scrapy
  6. Playwright
  7. How many IPs and threads
  8. What the errors mean
  9. How much traffic to plan
  10. Proxy or scraping API
  11. Law and site rules
  12. GonzoProxy for scraping
  13. FAQ

Proxies let a scraper send requests from many IP addresses and see a site as a visitor from a chosen country. They don't fix a wrong header, a missing cookie or a parser that saves block pages as data. Below: when you need them, how to connect them in Requests, Scrapy and Playwright, how to size a run and how to read errors.

When a scraper needs proxies

  • Volume. The site limits how much one visitor can request, and your job is larger than the limit.
  • Location. Prices, search results or stock depend on the country or city.
  • Separation. Several jobs run at once and should not share an address.

A few hundred pages from a site with an open API don't need a proxy. Use the API.

A proxy changes the IP address only. The HTTP standard for code 429 does not define how a server recognizes a client. It mentions a login or a cookie; counting by address is also common. Anti-bot systems also score the client itself. Cloudflare's bot score runs from 1 to 99, where 1 means automated and 2 to 29 likely automated.

Which proxy type to take

TypeWhere the IP comes fromTake it for
DatacenterHosting companiesSites that answer server and home addresses alike
ResidentialHome internet providersPrices, search results and stock by country
MobileCellular carriersChecks from a carrier network. The mobile version of a site is set by your User-Agent, not by the proxy

Don't choose by description. Take 100 of your own URLs, run them through datacenter and residential addresses and count complete pages. Then compare the cost of one complete page, not the cost of a gigabyte.

Rotating IP or sticky session

TaskMode
Product pages, search results, sitemapsRotating
Filters with pagination, cart, delivery regionSticky, a separate session ID per thread
Your own account after loginSticky, long session

Keep the IP, cookies and headers of one session together and discard them together. If the IP changes in the middle of a cart, the cookies describe one visitor and the address another.

In the GonzoProxy login, _c_us sets the country, _city_New-York the city, _s_a91f the session ID and _ttl_24h how long the session should keep its IP: 5m, 30m, 24h or 72h. A home device can go offline earlier, so the code must survive an IP change. Without _s_ the address rotates on new connections. A client that keeps connections open can send several requests through one address.

Requests

This function retries 429 and 5xx, obeys Retry-After in seconds up to a one-minute ceiling and stops at once if the proxy refuses with 407 or 403.

import time
import requests

PROXY = "http://LOGIN_c_us:PASSWORD@connect.gonzoproxy.app:10000"
PROXIES = {"http": PROXY, "https": PROXY}
RETRY = {429, 500, 502, 503, 504}

def pause(response, attempt, limit=60):
    value = response.headers.get("Retry-After", "") if response is not None else ""
    return min(int(value) if value.isdigit() else 2 ** attempt, limit)

def fetch(url, tries=3):
    for attempt in range(tries):
        response = None
        try:
            response = requests.get(url, proxies=PROXIES, timeout=30)
        except requests.exceptions.ProxyError as error:
            if "failed: 407" in str(error) or "failed: 403" in str(error):
                raise  # wrong login or a refused target: retrying won't help
        except requests.RequestException:
            pass
        if response is not None and response.status_code not in RETRY:
            return response
        if attempt < tries - 1:
            time.sleep(pause(response, attempt))
    return None

For SOCKS5, install requests[socks] and use socks5h://: domain names are then resolved on the proxy side.

Scrapy

Set the proxy through environment variables:

export http_proxy="http://LOGIN_c_us:PASSWORD@connect.gonzoproxy.app:10000"
export https_proxy="$http_proxy"
import scrapy

class CatalogSpider(scrapy.Spider):
    name = "catalog"
    custom_settings = {
        "CONCURRENT_REQUESTS_PER_DOMAIN": 2,
        "DOWNLOAD_DELAY": 1,
        "AUTOTHROTTLE_ENABLED": True,
        "ROBOTSTXT_OBEY": True,
    }

    async def start(self):
        yield scrapy.Request("https://example.com/catalog")

    def parse(self, response):
        yield {"url": response.url, "title": response.css("title::text").get()}

The example needs Scrapy 2.13 or newer. Many guides put the proxy into meta={"proxy": ...} of each request. In our check on 24 November 2026 that sent the page through the proxy, but robots.txt was requested directly from our own address. With environment variables both went through the proxy.

Playwright

A browser downloads everything on the page. This example skips images, video and fonts:

from playwright.sync_api import sync_playwright

BLOCK = {"image", "media", "font"}

with sync_playwright() as p:
    browser = p.chromium.launch(proxy={
        "server": "http://connect.gonzoproxy.app:10000",
        "username": "LOGIN_c_us_s_a91f_ttl_24h",
        "password": "PASSWORD",
    })
    page = browser.new_page()
    page.route("**/*", lambda route: route.abort()
               if route.request.resource_type in BLOCK else route.continue_())
    page.goto("https://example.com/catalog")
    print(page.title())
    browser.close()

Before a long run, open https://api.ipify.org through the proxy and check the exit address.

How many IPs and threads

Start from the limit of the site, not from the size of the pool:

IPs needed = pages per minute ÷ requests per minute the site accepts from one address

Example with assumed numbers: 600 pages a minute and 10 accepted requests give 60 addresses at a time. To find the real limit, run one thread with a one-second delay, then double the threads while the share of complete pages stays the same. Step back at the first 429 or captcha.

Scrapy's project template starts at one request per domain and a one-second delay. A script outside a project falls back to 8 requests and no delay, so set both values yourself.

What the errors mean

You seeLikely causeWhat to do
403The site refused the client, less often the proxy didCheck headers and fingerprint, then try another IP
407 (also inside ProxyError)The proxy refused the loginCheck the login and password, don't retry
429Too many requestsWait for Retry-After, slow down
5xx, or ProxyError with 502The site, the proxy exit or a server in betweenRetry with a growing pause
200 without the dataA captcha or a block pageCheck the content: a price field must hold a price

How much traffic to plan

The median desktop inner page weighed 1,963 KB in July 2025, the median HTML of inner pages 21 KB (Web Almanac 2025). For 100,000 such pages:

MethodTraffic
HTML only (Requests, Scrapy)about 2.1 GB
Full page in a browser, no cacheabout 196 GB

Headers and retries come on top. A browser cache can reduce the second number, but page.route in Playwright disables it. Measure 100 of your own URLs before buying.

Proxy or scraping API

A scraping API returns a finished page and takes over the browser and retries. A proxy gives you the address, and the code stays yours: any library, any login, any parsing logic. If you already have a working scraper, a proxy is a one-line change.

Law and site rules

Read the terms of the site and its robots.txt. The standard calls its rules "not a form of access authorization". Permission there doesn't by itself give you a legal right to use the data. Avoid personal data, keep the load low, and ask a lawyer in your country about commercial use.

GonzoProxy for scraping

Residential addresses in 180+ countries cost the same in every country, from $0.7 per GB. There are also datacenter and mobile proxies. HTTP, HTTPS and SOCKS5 work on one port. There is no subscription, and unused gigabytes do not expire between runs. Details are on the web scraping page; a 300 MB test package costs $1.99.

FAQ

Are residential proxies better than datacenter proxies for scraping?

Only where a site treats hosting addresses differently or shows other content by location. Test both on your URLs.

Should I rotate the IP on every request?

For independent pages, yes. For logins, carts and filtered pagination, keep one IP.

HTTP or SOCKS5 for scraping?

HTTP is enough: the proxy resolves the domain name. With SOCKS5, use socks5h, otherwise Requests resolves names locally.

Why does the site block me even with a proxy?

The IP is one signal of several. Check the request rate, headers, cookies and the browser fingerprint.

Have a question?

Contact our team for help choosing a pool and country for your workflow.

Message us on Telegram

300 MB trial
for $1.99

If it works for you, buy a package from 2 GB for $13. Traffic never expires. Pay with cryptocurrency. Your connection is available in the dashboard as soon as payment is credited.

Test any domain
with our proxies

No signup required. The test uses a real residential IP in your chosen country.

Example

Website check

No signup. The address stays in your browser.