Every honest crawler must follow robots.txt. The rules are set by the Robots Exclusion Protocol, published as RFC 9309 (IETF). Crawl-delay is not part of that standard, and Google ignores it (Google). But Cloudflare lists an AI crawler ignoring crawl-delay as grounds for removing its verified status (Cloudflare). If you want to be verified, honor it.
The problem
Many crawlers that get blocked were never malicious; they just didn't follow the house rules. A site that sees a bot ignoring robots.txt, or hammering it, has every reason to block it, and verification services treat that behavior as abuse. Following the rules exactly is the cheapest way to stay on the allowed side.
What RFC 9309 requires
These come straight from the standard (IETF):
| Rule | What your crawler does |
|---|---|
| Location | Fetch /robots.txt from the top of each host. It's UTF-8 plain text |
| Matching your group | Match your product token to user-agent lines, ignoring case. Merge all matching groups. If none match, use the * group |
| Allow vs disallow | The most specific rule (the longest match) wins. On a tie, allow wins. No match means allowed |
| Wildcards | Support * and $ |
| Size | Parse at least the first 500 KiB |
| Caching | Don't use a cached copy for more than 24 hours, unless the file is unreachable |
| Redirects | Follow at least five redirects |
| 4xx response | The file is unavailable: you may crawl |
| 5xx or network error | The file is unreachable: assume everything is disallowed |
That last row catches people out. If a site's robots.txt returns a server error, the standard says stop, not carry on.
Crawl-delay: not standard, still expected
RFC 9309 doesn't define crawl-delay. It treats unknown lines as "other records" that crawlers may interpret (IETF). Google says crawl-delay isn't supported and its parser ignores it (Google).
Cloudflare takes the opposite view for verified bots: an AI crawler ignoring the robots.txt crawl-delay directive is on its list of policy breaches (policy). The safe rule: if a site sets crawl-delay, wait at least that many seconds between requests to that host.
In code
Python's standard library parses robots.txt and reads crawl-delay:
import time
import urllib.error
import urllib.robotparser
UA = "ExampleBot"
rp = urllib.robotparser.RobotFileParser("https://example.com/robots.txt")
try:
rp.read()
except urllib.error.URLError:
rp.disallow_all = True # unreachable: the RFC says assume disallow
url = "https://example.com/some/page"
if rp.can_fetch(UA, url):
delay = rp.crawl_delay(UA) or 1 # fall back to 1 second if none is set
# fetch url here
time.sleep(delay)A limit to know: Python's built-in parser doesn't understand the * and $ wildcards, and it applies the first matching rule instead of the longest one. So it can say a page is allowed when RFC 9309 says it isn't, or the other way round. Use it for simple files, and use a parser that follows RFC 9309 for real crawling.
What the standard library does for you, as of Python 3.13: a 5xx response sets "disallow all," and other 4xx responses set "allow all". It is stricter on 401 and 403, which it treats as "disallow all." What it doesn't do: catch network errors (the try above handles that), or refresh the file. Re-read robots.txt at least every 24 hours. Older Python versions handled fewer of these cases, so check yours.
How we tested it: on Python 3.13 we parsed a sample file with a Crawl-delay: 5 line and a disallowed path; can_fetch and crawl_delay returned the expected results, and we read the library's own source to confirm its error handling.
Good manners beyond robots.txt
- Back off on
429and503responses, and respectRetry-After. - Spread requests to one host over time instead of in bursts.
- Name your bot honestly and link to a page explaining how to block it. See writing a user agent.
- Split crawlers by purpose. Sites now block training and agent bots separately from search (The Decoder).
How PacketPaper plans to help
Every bot on PacketPaper's planned network must follow robots.txt and crawl-delay; it's in our rules. We also plan rate limits on every plan and a way to pause any single bot at once, so one mistake doesn't cost you your verified status. Plans are planned, starting at $9 a month. Join the waitlist.