New videos every week — proxies, VPNs & antidetect browsers, explained.

Subscribe
PrivacyDec 4, 202615 min read

Ethical Web Scraping: robots.txt, Rate Limits and Responsible Data Collection

A practitioner playbook for ethical web scraping: read robots.txt properly, pace requests, honour 429s, identify your bot and minimise personal data.

Table of contents

Most scraping problems are not technical. The request works, the parser works, and the data lands in a table. The trouble comes later: a site owner notices a traffic spike at 3 a.m., a dataset turns out to hold thousands of people's personal details nobody needed, or a crawler keeps hammering an endpoint that robots.txt asked bots to leave alone. Ethical web scraping is the set of habits that keeps those things from happening. This guide is a practitioner playbook: how to read robots.txt and crawl-delay, how to pace requests, when to use an official API instead, how to handle personal data, and which lines you should not cross even when a tool makes it easy.

This is not legal advice

Ethics and law overlap but are not the same thing. This post covers responsible practice. For how courts and regulators have treated scraping and proxy use, read Are Proxies Legal? and talk to a lawyer about your specific project and jurisdiction.

What "ethical web scraping" actually means

Web scraping is just automated reading: a program fetches pages and extracts structured data from them. If you need a refresher on the mechanics, start with What Is Web Scraping and How Does It Work. The ethics question is not whether automation is allowed in principle. Search engines, price monitors, archivists and researchers have crawled the web for decades. The question is how you do it.

A useful working definition: an ethical scraper collects only the data it needs, from sources that have not clearly said no, at a pace the source can absorb, while being honest about who it is and careful with anything that identifies a person. Every section below is a concrete version of one of those clauses.

It helps to think of scraping as a negotiation rather than a fight. On one side are your data needs. On the other are the site's stated preferences (robots.txt, terms, rate-limit responses), its server capacity, and the interests of the people whose information might appear on the page. A good crawl finds a workable middle. A bad one treats every signal from the site as an obstacle to route around.

The five principles at a glance

PrincipleWhat it means in practiceSignal to watch
Ask the source firstLook for an official API, feed, export or licence before you write a crawler.Developer docs, data portals, sitemaps
Respect stated preferencesFetch and follow robots.txt for your user agent; read the terms that apply to you.robots.txt groups, Disallow rules, terms of service
Keep the load lightLimit concurrency per domain, add delays, back off on errors.429, 503, Retry-After, rising latency
Be identifiableUse an honest User-Agent with a contact URL; answer when someone reaches out.Abuse emails, blocks aimed at your crawler
Minimise personal dataCollect only fields you need, store them briefly, secure them.Names, emails, profile pages, photos

Start with the alternatives to scraping

The most ethical scrape is often the one you never run. Before writing a crawler, spend fifteen minutes checking whether the data is already offered in a structured way:

  • Official APIs. Many platforms publish APIs with documented rate limits and terms. They are usually more stable than HTML parsing, and you know exactly what you are allowed to do.
  • Feeds and sitemaps. RSS or Atom feeds and XML sitemaps list new and updated URLs so you do not have to discover them by crawling every page. A robots.txt file can point to sitemaps with a Sitemap: line.
  • Bulk exports and open data portals. Governments, research projects and some companies publish downloadable datasets. One download replaces thousands of requests.
  • Licensing or asking. For a large or ongoing project, an email to the site owner can turn a grey area into a clear agreement, sometimes with a better data feed than the public pages.

If none of those exist or they do not cover what you need, scraping public pages can still be reasonable. But you will have done the due diligence, and you will have a clearer picture of what the owner wants.

How to read robots.txt properly

robots.txt is a plain-text file at the root of a host (for example https://example.com/robots.txt) that tells crawlers which paths they are asked not to fetch. It has been around since the 1990s, and in 2022 the IETF published it as a formal standard, RFC 9309, the Robots Exclusion Protocol. Reading it correctly takes more than a glance at the first Disallow line.

Flowchart: fetch robots.txt, match user-agent group, apply the longest matching rule, then allow or skip the URL
How a well-behaved crawler decides whether a URL is fair game under robots.txt.

Groups and user agents

The file is split into groups. Each group starts with one or more User-agent: lines followed by Allow: and Disallow: rules. Your crawler should pick its name (RFC 9309 calls it a product token) and obey the group that matches it. If no group names your crawler, the User-agent: * group applies. A common mistake is to read only the wildcard group when the file has a more specific group for your bot.

Allow, Disallow and the longest match

When an Allow and a Disallow rule both match a URL, the standard says the most specific rule, meaning the longest matching path, wins. So Disallow: /shop/ plus Allow: /shop/public/ lets you fetch /shop/public/item but not /shop/cart. If no rule matches, the URL is allowed.

What the status code of robots.txt itself means

  • The file loads (200): follow its rules.
  • 4xx (for example 404): RFC 9309 treats this as "unavailable", and a crawler may access any resource. No file means no stated restrictions.
  • 5xx or network failure: this is "unreachable", and the crawler must assume complete disallow. Do not treat a server error as permission.
  • Caching: crawlers should not use a cached copy for more than 24 hours unless the file is unreachable. Long crawls should re-fetch it.

Check it in code

Python's standard library includes a parser, so there is little excuse for skipping the check:

from urllib import robotparser

UA = "AcmePriceBot"
rp = robotparser.RobotFileParser()
rp.set_url("https://example.com/robots.txt")
rp.read()

url = "https://example.com/products/widget"
if rp.can_fetch(UA, url):
    delay = rp.crawl_delay(UA)      # None if not set
    rate = rp.request_rate(UA)      # RequestRate(requests, seconds) or None
    print("allowed", delay, rate)
else:
    print("skip: disallowed for", UA)

If you use Scrapy, its documentation notes that projects created with scrapy startproject set ROBOTSTXT_OBEY = True in the generated settings. Leave it on unless you have explicit permission from the site.

robots.txt is a request, not a lock

RFC 9309 says plainly that these rules are not a form of access authorization. That cuts both ways: a site cannot rely on robots.txt for security, and a scraper cannot read "technically reachable" as "invited". Ethical crawlers honour it voluntarily.

Crawl-delay and other non-standard lines

You will often see a Crawl-delay: line. It is not part of RFC 9309, and search engines disagree about it. Google's robots.txt documentation lists the fields it supports (user-agent, allow, disallow, sitemap) and says other fields such as crawl-delay are not supported. Bing's webmaster documentation, by contrast, says Bingbot honours crawl-delay.

For your own scraper the practical rule is simple: if the site bothered to write a crawl-delay, treat it as the minimum gap between your requests to that host. You lose almost nothing by being slower than asked, and you show that you read the file. The same goes for the rarer Request-rate line, which Python's parser also exposes. If neither is present, that is not an invitation to go flat out; use the pacing defaults in the next section.

Rate limits and polite pacing

Load is where scrapers cause real harm. A small shop's server may be sized for a few hundred human visitors, not a script firing dozens of parallel requests. Polite pacing is also self-interested: aggressive traffic is the fastest way to get blocked, as covered in How Websites Detect Bots.

Diagram of a polite request loop: request, 429 or 503 response, wait for Retry-After, back off, then resume at a slower pace
Treat 429 and 503 responses as instructions to slow down, not obstacles to route around.

Limit concurrency per domain

Count parallel requests per host, not just globally. Scrapy's own defaults are a useful reference point: its settings documentation lists CONCURRENT_REQUESTS_PER_DOMAIN with a default of 1 and DOWNLOAD_DELAY with a default of 1 second for new projects. Starting there and only raising limits when the site clearly copes is a sensible habit for any tool.

Adapt to how the server responds

Fixed delays are a start; adaptive delays are better. Scrapy's AutoThrottle extension, for example, uses download latency to adjust the delay so the crawler keeps a target number of concurrent requests per site. The idea is that if a server takes longer to respond, you send fewer requests. You can build the same thing in any language: track response times and widen the gap when they rise.

Honour 429, 503 and Retry-After

HTTP status 429 Too Many Requests, defined in RFC 6585, means you sent too many requests in a given time. The response may include a Retry-After header saying how long to wait. A 503 can carry the same header. When you get either:

  1. Stop sending to that host.
  2. Wait at least the Retry-After value if one is given.
  3. Otherwise use exponential backoff with jitter (for example 2, 4, 8, 16 seconds plus a random offset).
  4. Resume at a lower rate than before, not the same one.
  5. If errors keep coming, pause the job and investigate instead of retrying forever.
import random, time, requests

def polite_get(session, url, max_tries=5):
    wait = 2
    for attempt in range(max_tries):
        r = session.get(url, timeout=30)
        if r.status_code not in (429, 503):
            return r
        ra = r.headers.get("Retry-After")
        sleep_for = int(ra) if ra and ra.isdigit() else wait + random.uniform(0, 1)
        time.sleep(sleep_for)
        wait *= 2
    raise RuntimeError(f"giving up on {url} after {max_tries} tries")

Fetch less

  • Cache responses and do not re-download pages that have not changed. Conditional requests with If-Modified-Since or If-None-Match let the server answer with a cheap 304.
  • Use sitemaps to find changed URLs instead of re-crawling everything.
  • Skip assets you do not need. If you only want prices, do not download images, fonts and video.
  • Schedule sensibly. Large one-off crawls are kinder during the site's quieter hours.

Identify yourself honestly

An honest scraper is one a site owner can contact. Set a descriptive User-Agent that names your crawler and links to a page explaining what it does and how to reach you, for example AcmePriceBot/1.0 (+https://acme.example/bot). RFC 9309 also expects the product token your crawler matches in robots.txt to be part of the User-Agent you send, so the two line up.

This is where ethical scraping and stealth scraping pull in different directions. Many anti-bot guides recommend copying a real browser's headers so you blend in. There are legitimate reasons to render pages with a real browser, such as JavaScript-heavy sites. But pretending to be a human visitor specifically so that a site which has blocked your crawler cannot tell it is you is a different thing. If a site has singled out your bot, the honest response is to ask, not to disguise.

Where proxies fit

Proxies are not unethical in themselves. Teams use them to see region-specific prices and search results, to spread legitimate load across exits, and to keep their office IP out of target logs. The line is intent and effect: rotating IPs so that a site's rate limit or block on you no longer works is evasion, whatever tool does it. Use proxies to get an accurate view of the web, not to multiply your request rate beyond what one polite client would send. Our guide to avoiding CAPTCHAs when scraping follows the same logic: the most reliable way to avoid challenges is to behave like a considerate client.

What not to bypass

Some barriers are signals, and some are walls. Treat these as walls unless you have explicit permission:

  • Logins and paywalls. Content behind an account or a subscription was not offered to the public. Scraping it with shared, bought or fake credentials is off the table, and terms you accepted when you signed up generally apply to automated use of your own account too.
  • Explicit blocks. If a site has blocked your crawler by user agent or IP, or emailed you to stop, stop. Routing around the block through new IPs or new identities is the clearest ethical line in scraping.
  • Technical access controls. Breaking authentication, exploiting bugs, or calling undocumented private endpoints you were never given access to is not scraping public data.
  • CAPTCHAs on flows that are meant to keep bots out. Pacing yourself so you rarely see a challenge is fine. Paying a farm to solve challenges on a site that has made clear it does not want automated access is not.

A simple test

Ask: "If the site owner watched my crawler run, would they recognise it as the kind of access they publicly allow?" If the honest answer is no, change the plan or ask for permission.

Handling personal data responsibly

Public does not mean free of obligations. Profile pages, reviews, forum posts and directories often contain names, photos, usernames and contact details. In the EU and UK, the GDPR applies to personal data whether or not it was publicly posted, and its core principles are a good ethical baseline everywhere. Article 5 includes purpose limitation, data minimisation (data should be "adequate, relevant and limited to what is necessary"), storage limitation and security.

Turned into engineering rules:

  • Decide the purpose first and write it down. If a field does not serve it, do not collect it.
  • Drop or pseudonymise identifiers at ingestion when you only need aggregates. Counting reviews per product does not require reviewer names.
  • Avoid sensitive categories such as health, religion, political views or anything about children unless you have a clear, lawful and reviewed reason.
  • Set a retention period and actually delete old raw HTML and extracted records.
  • Secure the dataset like any other customer data: access control, encryption, no copies on personal laptops.
  • Have a removal path. If someone asks to be taken out of your data, you should be able to find and delete them.

Collecting data and republishing it are different acts. Facts such as a price, a stock level or a flight time are generally treated differently from creative expression such as articles, photos and reviews. Copying a site's content wholesale and republishing it, or using it to build a competing copy of the site, is where most scraping disputes start. Ethical practice: extract the specific facts you need, transform or aggregate them, link back where you quote, and do not present someone else's work as your own. The legal detail varies a lot by country, so for anything beyond internal analysis, get advice and read our legality overview.

Choosing infrastructure responsibly

Your vendors are part of your ethics. A residential proxy pool built from people who never meaningfully agreed to share their connection makes your crawl depend on someone else's harm, however polite your code is. Our checklist on what makes a proxy provider trustworthy covers sourcing, consent and customer vetting in detail. Two providers that publish material on compliance:

Zyte

Zyte, the company behind the open-source Scrapy framework, publishes a web scraping best-practices guide and a data-compliance page that discuss rate limiting, robots.txt and personal data. It suits teams that want a managed scraping API with a compliance conversation built into onboarding rather than raw IPs.

Zyte logo

Zyte

Proxy
4.4
Editor

Zyte API is the most complete scraping-as-a-service offering from the most credible engineering lineage in the space (they wrote Scrapy). Automatic ban handling, escalation, and rendering behind a success-priced API genuinely deletes the proxy-ops workload. It is not a general-purpose proxy — account management and browser-based workflows need conventional providers — and heavy scraping teams with anti-bot expertise can beat its per-request economics. For developer teams whose product is the data, not the infrastructure, it is the benchmark.

From $0.10/1K requests

Bright Data

Bright Data runs a public Trust Center describing its approach to ethical web data collection. Its documentation states that residential network access is granted only to registered companies after a human-reviewed KYC check by its compliance team. That gatekeeping is the kind of customer vetting worth looking for when you need residential IPs.

B

Bright Data

ProxyFeatured
4.7
Editor

Bright Data remains the most complete data-collection platform money can buy. No competitor matches its combination of network scale, targeting granularity, and compliance tooling — and for enterprise teams whose revenue depends on reliable data, that completeness justifies the premium. The trade-offs are real: it is one of the priciest providers per gigabyte, the interface overwhelms newcomers, and KYC verification adds friction before you can route a single request. Smaller projects will get better value from Decodo or IPRoyal. But if you need city-level residential targeting at scale, a managed unblocker for the hardest targets, and audit-ready compliance, Bright Data is the default — and our highest-rated proxy provider overall.

Vendors do not transfer responsibility

A compliant provider reduces risk on the sourcing side. It does not make an impolite or privacy-careless crawl acceptable. Pacing, robots.txt and data minimisation are still on you.

A pre-flight checklist for every scraping project

  1. Write down the purpose and the exact fields you need.
  2. Check for an API, feed, sitemap, export or licence.
  3. Read the terms that apply to you, especially if you have an account.
  4. Fetch robots.txt, match your user-agent group, and respect Disallow and any crawl-delay.
  5. Set an honest User-Agent with a contact URL.
  6. Cap concurrency per domain and add a delay; plan adaptive throttling.
  7. Handle 429 and 503 with Retry-After and backoff.
  8. Strip personal data you do not need at ingestion; set retention and access controls.
  9. Log what you fetched and when, so you can answer questions later.
  10. Decide in advance what you will do if the site asks you to stop.

When a site owner gets in touch

Sooner or later someone will email the contact address in your User-Agent. Treat it like a support ticket, not an attack. Pause or slow the crawl for that host straight away, reply with what your bot does and what you collect, and ask what they would accept: a lower rate, a different time window, a specific path, or an official feed. Often the outcome is better data with less effort. If they ask you to stop entirely, stop, and delete what you do not have another basis to keep.

Bottom line

Ethical web scraping comes down to a handful of habits: look for an official source first, read robots.txt the way the standard describes, treat crawl-delay and 429 responses as instructions, identify yourself, collect as little personal data as you can, and never route around a clear "no". These habits make your crawls more stable too, because sites rarely spend effort fighting a crawler that behaves like a good guest. When the law matters, and for commercial projects it usually does, pair this playbook with proper legal advice.

Frequently asked questions

Ethical web scraping means collecting only the data you need, from sources that have not clearly said no, at a pace the site can handle, while identifying yourself honestly and handling personal data carefully. It covers robots.txt, rate limits, user-agent transparency and data minimisation.

robots.txt is a voluntary standard (RFC 9309) and the RFC itself says it is not a form of access authorization, so ignoring it is not automatically illegal everywhere. It is, however, the site's clearest stated preference, and ignoring it can matter in disputes. This is not legal advice; check the law that applies to your project.

No. Google's robots.txt documentation says it supports user-agent, allow, disallow and sitemap, and that other fields such as crawl-delay are not supported. Bing's documentation says Bingbot honours crawl-delay. For your own scraper, treat any crawl-delay as the minimum gap between requests.

There is no universal number because servers differ widely. A safe starting point is one concurrent request per domain with a delay of about a second, which matches Scrapy's project defaults, then adjust based on response times and any 429 or 503 responses.

Stop sending to that host, wait for the Retry-After period if the response includes one, and otherwise back off exponentially with some random jitter. When you resume, use a lower rate than before, and pause the job if errors continue.

Proxies are a neutral tool. Using them for geo-specific results, reliability or to keep your own IP private is common and reasonable. Using them to evade a block or rate limit that a site has aimed at you is not, and you should also choose providers whose IPs are ethically sourced.

Being public does not remove privacy obligations. Under the GDPR, for example, data minimisation and purpose limitation still apply to publicly posted personal data. Collect only fields you need, drop or pseudonymise identifiers early, set retention limits and be able to delete records on request.

If a site offers an official API, feed, sitemap or bulk export that covers your needs, use it first. It is usually more stable, puts less load on the site, and comes with clear terms about what you are allowed to do.

Found this useful? Share it.