1. phantom
  2. Useful
  3. Proxies for scraping

Useful · Phantom Proxy

Proxies for web scraping: how to choose and set them up

The right proxy type for scraping depends on volume, site protection and the geography you need. Here is how to choose a type, set up rotation and stay within rate limits — with a Python example.

Updated 29 Nov 2026

In short

  • Start with datacenter proxies; move to residential when the site starts refusing requests.
  • Independent pages: a new IP per request. Chains with cookies: a sticky session.
  • Limit your rate, retry with backoff and collect only publicly available data.

Where to start

  • Volume. How many pages per day, and how large. This decides what is cheaper: paying per address or per gigabyte.
  • Site protection. Does the site serve data to any visitor, or does it show CAPTCHAs and block datacenter IPs?
  • Geography. Do you need a specific country or city? Prices, stock and search results often depend on the visitor’s region.
  • Sessions. Do you need to keep cookies and go through several steps in a row: filters, pagination, forms?

Estimating traffic is simple: average response size × number of requests. For example, 100,000 HTML pages at 300 KB each come to about 30 GB. Check the response size in your browser’s developer tools or in your scraper’s logs. In a headless browser, turn off images, fonts and video: with rotating proxies, all traffic in both directions is billed.

Which proxy type fits

TypeWhen it fitsLimitations
Datacenter IPv4Sites without strict protection, high volume through a fixed set of addresses. The price does not depend on traffic — from ₽114 / IP.Sites can recognize datacenter addresses; you get as many IPs as you buy.
Rotating datacenterMany different IPs without buying each address, the cheapest traffic — from ₽126 / GB.Still datacenter addresses: more rejections on protected sites.
Rotating residentialSites with anti-bot protection, data by region and city — from ₽189 / GB.Traffic costs more; heavy pages make the bill grow fast.
Residential ISPMulti-step flows and long sessions that need one stable home IP.Costs more than datacenter, fewer countries; you get as many addresses as you buy.
[IPv6](ipv6-proxy)The site supports IPv6 and you need many addresses on a small budget.Does not work with sites without IPv6; minimum order 10 addresses.

A practical order: start with datacenter IPv4 or rotating datacenter and measure the share of successful responses. If a site starts answering with 403s or CAPTCHAs en masse, move that domain — not the whole project — to rotating residential. Mobile proxies are rarely needed for scraping, as they are the most expensive traffic; try them when a site serves different data to mobile users or keeps out the other types. All types are compared in the proxy types guide.

Rotation and sessions

Rotating proxies work through the gw.phantom-proxy.top gateway. The easiest way is generated lines: in the dashboard or via the API, set the number of lines, the country, the rotation interval and the format, for example http://user:pass@host:port. The country and interval are built into each line’s login, and each line has its own port.

  • A new IP on every request — for independent pages: product pages, catalog pages, search results for a list of queries.
  • A sticky session of 1 to 120 minutes — when several requests must come from one IP: filters, pagination with cookies, multi-step forms.
  • One line per worker. To run in parallel, generate as many lines as you have workers and pin a line to a worker for the length of a session.

Choosing a country is free. Region, city or ISP targeting uses traffic twice as fast — enable it only when the data really depends on the city.

Rate, concurrency and retries

  • Limit the rate per domain. Start with a small number of concurrent requests and pauses between them, increase gradually, and watch the share of 429 and 403 responses.
  • Spread the load across IPs. If a site tolerates, say, 10 requests per minute from one address and you need 300, you will need about 30 addresses or per-request rotation.
  • Retry with growing pauses: 1, 2, 4, 8 seconds plus random jitter, no more than 3–5 attempts. If the server sends Retry-After, wait as long as it asks.
  • Do not retry what cannot succeed. Retrying does not fix 404 or 407; a 403 or 429 is a reason to switch IP and slow down, not speed up.
  • Set timeouts separately for connecting and for reading the response, so a hung request does not block a worker.

If you plan to run hundreds of parallel connections, check the limits with support in advance.

Headers

  • Send a meaningful User-Agent and the usual Accept and Accept-Language headers: many sites reject the default python-requests/… straight away.
  • Keep language and region consistent: Accept-Language should match the IP’s country.
  • Keep cookies and the User-Agent within one session and one IP; when the IP changes, start a new session.
  • If the site offers a public API or data export, use it: it is faster and puts less load on the site.

Rules and the law

Proxies do not change the legal side of scraping. Collect only publicly available data, do not bypass logins or paywalls, and do not create load that disrupts the site.

  • Check robots.txt and the site’s terms of use: they may contain explicit bans and rate limits.
  • Names, phone numbers, emails and profiles of people are personal data. Collecting them is governed by data protection laws, such as the GDPR in the EU or Federal Law 152-FZ in Russia. Do not collect such data without a legal basis.
  • Follow the Phantom Proxy rules: collecting public data is allowed; spam, attacks and other illegal activity are forbidden.

Python example

In the dashboard, generate lines in the http://user:pass@host:port format with the country you need and per-request rotation, and save them to proxies.txt. The code picks a random line for every attempt, retries with a pause and respects Retry-After.

import random
import time

import requests

# proxies.txt: lines from the dashboard, one per row, e.g.:
# http://LOGIN:PASSWORD@gw.phantom-proxy.top:PORT
PROXIES = [s.strip() for s in open('proxies.txt', encoding='utf-8') if s.strip()]
HEADERS = {
    'User-Agent': 'Mozilla/5.0 (compatible; MyParser/1.0; +https://example.com/bot)',  # set your own User-Agent and contact
    'Accept-Language': 'en-US,en;q=0.9',
}


def fetch(url, attempts=4):
    for attempt in range(attempts):
        proxy = random.choice(PROXIES)  # another line = another IP
        try:
            r = requests.get(url, headers=HEADERS, timeout=(10, 30),
                             proxies={'http': proxy, 'https': proxy})
        except requests.RequestException:
            r = None  # timeout or dropped connection: retry
        if r is not None:
            if r.status_code == 200:
                return r.text
            if r.status_code == 404:
                return None  # no such page: retrying will not help
            if r.status_code == 407:
                raise RuntimeError('407: check LOGIN and PASSWORD')
        wait = r.headers.get('Retry-After', '') if r is not None else ''
        delay = int(wait) if wait.isdigit() else 2 ** attempt  # 1, 2, 4, 8 s or as long as the server asks
        time.sleep(min(delay, 60) + random.random())
    return None


for url in ['https://example.com/catalog?page=1', 'https://example.com/catalog?page=2']:
    html = fetch(url)
    time.sleep(1 + random.random())  # pause between pages

For SOCKS5, install requests[socks] and use the socks5h:// scheme with the SOCKS port — then DNS lookups also go through the proxy.

Common errors

ErrorWhat it meansWhat to do
407 Proxy Authentication RequiredThe proxy rejected the username or password.Copy the line again without spaces; check that the order is active and traffic has not run out. Retrying will not help.
403 ForbiddenThe site denied access — often because of the IP type or headers.Check your headers, slow down, try rotating residential. Bank and government sites may be blocked on rotating pools.
429 Too Many RequestsThe request limit for the address or session was exceeded.Wait for the time in Retry-After, reduce concurrency, spread requests across more IPs.
CAPTCHA instead of the pageThe site considers the traffic automated.Slow down, use a sticky session with cookies or a residential IP type.
Timeout, 502 / 503The site or the proxy did not respond in time.Retry after a pause. If it happens on all addresses, check the host, port and protocol and contact support.

FAQ

Which proxy type is best for scraping?

There is no universal one. For most sites, datacenter IPv4 or rotating datacenter is enough; for sites with anti-bot protection and regional data, rotating residential.

How many proxies do I need?

Your target rate divided by the rate the site tolerates from one address. You need to measure that on your target site. With per-request rotation you do not buy addresses at all — you pay for traffic.

How much traffic will I use?

Average response size × number of requests: 100,000 pages at 300 KB come to about 30 GB. Purchased traffic never expires, so you can start small — from 1 GB.

Do you guarantee the site will not block me?

No. Blocks depend on the site’s protection and your behavior. If a working static address is blocked by a particular site, that does not count as a fault — see the replacement terms.

Can I scrape over IPv6?

Yes, if the site supports IPv6: check for an AAAA record with dig AAAA example.com. The minimum order is 10 addresses.

Can I get rotating lines via the API?

Yes: the connection lines method returns ready-made lines with the country and interval you choose. See the API documentation.