Tool · Live

Bayanat Labs polite-fetch Crawler Library

polite-fetch is the Python library that enforces the policy of the BayanatLabs-OpenData crawler, which fetches files and pages for Bayanat Labs open datasets and studies. Before it requests a page it reads robots.txt as RFC 9309 describes, and for every URL it records the signals the site gave (blocks of named AI crawlers, TDMRep reservations, Content-Signal, IETF Content-Usage, X-Robots-Tag or meta noai and RSL licence lines) together with a decision: fetch, index only, skip or stopped. The most restrictive signal decides, and the rule that gave the decision is written to a signals ledger. Each worker sends at most one request every 3 seconds to a host, honours Retry-After, and stops at an access denial, a login page, a bot challenge or a CAPTCHA page without trying to get past it. Every statement about crawler behaviour on the crawler page is mapped to the tests that check it: 634 conformance tests, all passing, against a local fixture server with 80 scenarios. The policy is also published as crawler.json.

By Bayanat Labs· Updated · Apache-2.0· اقرأ بالعربية
LicenceApache-2.0 (code); CC BY 4.0 (documentation); CC0 1.0 (crawler policy); MIT (bundled AI crawler names from ai.robots.txt)
Versionv0.1.0 · Library v0.1.0 with crawler policy 1.0.0, tagged on GitHub. Not on PyPI yet.
Published
Updated
Who it is forEngineers who build web datasets and want a crawler that follows robots.txt and AI-use opt-out signals, records each decision with its rule, and stops when a site refuses access; site owners who want to see how the BayanatLabs-OpenData crawler treats their signals.
LevelIntermediate

robots.txt AI crawler opt-out TDMRep Content-Signal polite crawler

Key numbers

634conformance tests, run against a local fixture server and never against real sites
634of them passing
80scenarios on the fixture server: robots.txt variants, TDMRep files and headers, Content-Signal lines, rate-limit answers, challenges, CAPTCHA pages, login redirects, Arabic paths and an internationalised domain name
202AI crawler names in the pinned list from the ai.robots.txt project; a robots.txt block of any of them makes a page index only
3seconds at least between two requests from one worker to the same host, over one connection
1second at least between requests to hosts that a run names as bulk dump or API hosts
60seconds of wait after a rate-limit or overload answer without Retry-After
300seconds after a second such answer in a row
900seconds after a third; a host that still refuses, or asks for a longer wait, is stopped

Counted by script from the released files. Each key number is read from docs/conformance/summary.json or policy/crawler.json in the repository at tag v0.1.0 and pinned to its SHA-256. The same crawler.json is served at bayanatlabs.com/open/crawler.json.

Downloads and identifiers

Get started

Install from GitHub at the v0.1.0 tag; the package is not on PyPI yet. check gives the decision for a URL from robots.txt and tdmrep.json without requesting the page.

pip install "git+https://github.com/Bayanat-Labs/polite-fetch@v0.1.0"

polite-fetch check https://example.org/page --purpose training_release
polite-fetch fetch https://example.org/page --headers-only --ledger signals.jsonl

from bayanatlabs_polite_fetch import Fetcher

with Fetcher(worker_id="worker-1", ledger="signals.jsonl") as f:
    r = f.fetch("https://example.org/page", purpose="training_release")
    print(r.decision, r.decision_reason)

What is released

PartLicenceIn this release
Python library and command-line tool (bayanatlabs_polite_fetch) for Python 3.10 or later, with one runtime dependency (httpx)Apache-2.0Yes
Local fixture server and conformance testsApache-2.0Yes
Crawler policy 1.0.0 (policy/crawler-policy.yaml and the generated crawler.json)CC0 1.0Yes
Documentation: README in English and Arabic, crawler page text, conformance report, traceability table and signals ledger schemaCC BY 4.0Yes
AI crawler names from robots.json of the ai.robots.txt project, pinned to one commitMITYes

Attribution: polite-fetch by Bayanat Labs. https://github.com/Bayanat-Labs/polite-fetch

Intended uses

  • Fetch pages and files for a dataset under a fixed, published crawler policy, with the decision and its rule recorded for every URL.
  • See what the crawler would decide for a URL (robots.txt group, AI crawler blocks, TDMRep, Content-Signal, Content-Usage) before the page is requested.
  • Reuse the fixture server and conformance tests to check how another crawler handles robots.txt and opt-out signals.

Out of scope

  • Deciding whether content may legally be reused: the library reads machine-readable signals, not terms of use or licences.
  • Getting past access controls: it stops at logins, bot challenges and CAPTCHA pages and has no option to bypass them.

Rights at a glance

Training, display, redistribution and synthetic-voice use are separate permissions.

UseStatusNote
TrainingNot applicableA library and a policy file, not training data.
DisplayAllowedDocumentation and page text under CC BY 4.0 with attribution; crawler.json under CC0 1.0.
RedistributionAllowedCode under Apache-2.0; documentation under CC BY 4.0; crawler policy under CC0 1.0; the bundled AI crawler names under the MIT licence of the ai.robots.txt project.
Synthetic voiceNot applicableNo audio.

Limitations

  • Rate limits and stop rules hold per worker; several workers on the same host are not coordinated by the library, so run one worker per host.
  • The IETF AI preferences vocabulary (Content-Usage) is still a draft; values are recorded as found, and any n value makes a record index only.
  • Challenge and CAPTCHA detection uses response headers and page markers; when only headers are read, meta tags and page bodies are not checked.
  • The documented-download exception relies on the documentation address the caller gives; the library records it but does not read that page.
  • The conformance tests run against a local fixture server, never against real sites, so real servers can answer in ways the fixtures do not cover.
  • Install from GitHub for now; the package is not on PyPI yet.

Sources and licences

SourceLicenceRedistributed here
RFC 9309: Robots Exclusion ProtocolImplemented; no text includedNo
ai.robots.txt project, robots.json at commit d8e8b77MIT; the crawler names are bundled with the licence noticeYes
TDMRep, W3C Community Group final reportImplemented; no text includedNo
Content Signals Policy (Content-Signal in robots.txt)Implemented; no text includedNo
IETF AI Preferences working group drafts (Content-Usage)Implemented from the drafts; no text includedNo

polite-fetch implements published specifications and does not reproduce their text. The AI crawler names come from robots.json of the ai.robots.txt project, pinned to one commit, and are bundled under its MIT licence with the notice. The crawler page on bayanatlabs.com describes crawler behaviour only where the library enforces it; the traceability table in the repository maps each statement about crawler behaviour to the tests that check it, and the build fails when such a statement has no test. Source details

How to cite

Cite as:

Bayanat Labs (2026). polite-fetch: the library behind the BayanatLabs-OpenData crawler, version 0.1.0, crawler policy 1.0.0. Bayanat Labs. https://github.com/Bayanat-Labs/polite-fetch

No DOI. Cite the URL in the citation above and the date you read it.

@misc{bayanatlabs2026politefetch,
  author       = {{Bayanat Labs}},
  title        = {polite-fetch: the library behind the BayanatLabs-OpenData crawler, version 0.1.0, crawler policy 1.0.0},
  year         = {2026},
  month        = oct,
  howpublished = {\url{https://github.com/Bayanat-Labs/polite-fetch}}
}

How we handle citations

Changelog

DateVersionChange
v0.1.0Python library, command-line tool, crawler policy and conformance tests on GitHub; the crawler page and crawler.json on bayanatlabs.com.

Corrections and removal requests

If something in this release should not be there, or is wrong, email hello@bayanatlabs.com. We handle removal requests within 30 days, and platform requests within 24 hours. How removal requests work

Related product: Bayanat Knowledge

Need production-grade, rights-cleared data?

We publish synthetic fixtures, open benchmarks, results, code and guides for free. Data at scale is licensed or built to order: ready-to-license Arabic speech and text datasets with commercial AI-use rights written into the agreement, and custom collection, annotation and evaluation.

Bayanat Knowledge: License books, subject-organized MSA text, and structured question-answer data. Each collection has a clear training task, with its own counts and licensing details.