---
title: "Proxies for Web Scraping: Types, Rotation & Python Setup"
description: "When you need a proxy for web scraping, datacenter vs residential vs ISP vs mobile proxies, how to use and rotate proxies in Python requests and Playwright, sticky sessions, what drives cost, and when an extraction API is simpler."
category: "guides"
url: https://keirolabs.cloud/blog/proxies-for-web-scraping
published: 2026-11-24
updated: 2026-11-24
---

# Proxies for web scraping: datacenter vs residential, rotation and Python setup

## The 60-second version

**A proxy for web scraping sends your requests through another IP address, so a site sees the proxy's IP instead of yours.** Scrapers use proxies to spread requests across many IPs, avoid per-IP rate limits and blocks, and request pages as if from a specific country.

| Proxy type | What the IP is | Cost | Gets blocked | Best for |
|---|---|---|---|---|
| Datacenter | Cloud or hosting provider IPs | Lowest | Most often: easy to recognize | Sites with light protection, high volume |
| Residential | Home internet connections (ISPs) | High, usually per GB | Rarely | Protected sites, geo-specific results |
| ISP (static residential) | ISP-registered IPs hosted in data centers | Medium-high | Rarely | Long sessions that need a stable IP |
| Mobile | Mobile carrier IPs | Highest | Very rarely | The hardest targets, mobile-only content |

**Start without proxies, add datacenter proxies when you get rate-limited, and move to residential only for sites that block datacenter IPs.** Or skip proxy management entirely with an extraction API that handles it.

## When do you need a proxy for web scraping?

**Not as often as people think.** Try in this order:

1. **No proxy, polite scraping.** Many sites never block a scraper that sends one request every second or two with a real user-agent.
2. **Datacenter proxies** when you start seeing HTTP 429 (Too Many Requests) or 403 errors from volume.
3. **Residential proxies** when a site blocks datacenter IP ranges outright, or when you need results as seen from a specific city or country.
4. **Plus a headless browser** when the site also checks JavaScript execution or browser fingerprints. A proxy alone won't pass those checks.

**Signs you're being blocked:**

- HTTP 403 or 429 responses.
- A CAPTCHA page instead of content.
- Empty or truncated HTML.
- A "verify you are human" interstitial.
- Responses that suddenly differ from what you see in your own browser.

## How do I use a proxy in Python?

**With `requests`, pass a `proxies` dict.** Most proxy providers give you a single gateway address that rotates the exit IP for you:

```python
import requests

PROXY = "http://USERNAME:PASSWORD@proxy.example.com:8000"   # your provider's gateway
proxies = {"http": PROXY, "https": PROXY}

r = requests.get("https://httpbin.org/ip", proxies=proxies, timeout=30)
print(r.json())   # shows the proxy's exit IP, not yours
```

**Rotating through your own list of proxies,** with retries on blocks:

```python
import itertools, random, time
import requests

PROXIES = ["http://user:pass@1.2.3.4:8000", "http://user:pass@5.6.7.8:8000"]
pool = itertools.cycle(random.sample(PROXIES, len(PROXIES)))

def fetch(url: str, attempts: int = 4) -> str:
    for i in range(attempts):
        p = next(pool)
        try:
            r = requests.get(url, proxies={"http": p, "https": p}, timeout=30,
                             headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"})
            if r.status_code == 200:
                return r.text
            if r.status_code in (403, 429):        # blocked or rate-limited: rotate and back off
                time.sleep(2 ** i)
                continue
            r.raise_for_status()
        except requests.RequestException:
            time.sleep(2 ** i)
    raise RuntimeError(f"all attempts failed for {url}")
```

**With Playwright,** set the proxy when launching the browser: `chromium.launch(proxy={"server": "http://proxy.example.com:8000", "username": "...", "password": "..."})`. There's a fuller browser setup in [web scraping with Playwright in Python](/blog/playwright-scraping).

## Rotating vs sticky sessions

- **Rotating:** a new IP on every request. Best for scraping many independent pages, such as search results or product pages.
- **Sticky:** the same IP for several minutes. Needed when a site ties state to your IP: logins, carts, multi-step flows, or pagination that breaks if the IP changes.

Most providers offer both through the same gateway, usually chosen with a session ID in the username.

## What do scraping proxies cost?

**Datacenter proxies are usually priced per IP or per request. Residential and mobile proxies are usually priced per GB of traffic,** and that is where costs surprise people.

- **Pages are heavy.** A page that pulls in large scripts, images and fonts can transfer several megabytes. Through a per-GB residential proxy, the bandwidth costs more than the request.
- **Block what you don't need.** In a headless browser, block images, fonts and media to cut bandwidth. With plain HTTP, request only the HTML.
- **Retries multiply cost.** Each blocked attempt still uses bandwidth.

Compare providers on cost per *successful* page for your target sites, not on the advertised price per GB.

## Proxies or an extraction API?

**Running your own proxies means managing rotation, retries, bans, CAPTCHAs, headless browsers and bandwidth bills.** An extraction API bundles all of that and charges per successful page.

| | DIY scraper + proxies | Extraction API |
|---|---|---|
| You manage | Proxy pool, rotation, retries, browsers, parsing | Nothing: send a URL |
| Pricing | Proxy bandwidth or IPs, plus your servers | Per page |
| Output | Raw HTML; you parse it | Clean markdown or JSON |
| Best when | Very high volume on a few sites you know well | Many different sites, AI pipelines, small teams |

With Keirolabs (ours), extraction is one call:

```python
import os, requests

r = requests.post("https://api.keirolabs.cloud/api/v2/extract",
                  headers={"Authorization": f"Bearer {os.environ['KEIRO_API_KEY']}"},
                  json={"url": "https://example.com/pricing"}, timeout=60)
print(r.json()["results"][0]["content"][:500])   # clean markdown of the page
```

That's 2 credits a page on paid plans. For finding pages rather than fetching known ones, a search API skips scraping search engines entirely; see [web crawling vs web scraping](/blog/web-crawling-vs-web-scraping).

## Checklist

- **Try polite scraping without proxies first.**
- **Use datacenter proxies for volume, residential for protected or geo-specific sites.**
- **Rotate IPs per request; use sticky sessions for logins and multi-step flows.**
- **Back off on 403 and 429 responses; don't hammer.**
- **Block images and media to save bandwidth on per-GB plans.**
- **Measure cost per successful page.**
- **Consider an extraction API when proxy management becomes the job.**

New Keirolabs accounts get up to 2,000 free credits with no card ([get a key](https://platform.keirolabs.cloud/register)).
