~/TechPurAI
~/tutorials/web-scraping-with-python/planning-your-scraper
beginner·part 1 of 6·3 min read

Planning a scraper: picking a target, and reading its robots.txt

Updated Aug 14, 2026Python

Web scraping is really four separate problems wearing one name: fetching a page, parsing it into structured data, crawling to more pages, and storing what you found — reliably enough to run more than once. This series builds all four, one part at a time, into a real scraper for quotes.toscrape.com, a site built specifically for scraping practice. By the end you'll have a script that walks every page, follows each author's bio, and saves the result to CSV and JSON.

What you'll build

A single Python script that:

Each part below builds one piece. By part 6 they're combined into the finished script.

Pick a target you're actually allowed to scrape

Before anything else: check if the site has a public API first. An API is a target that wants to be queried programmatically — stable field names, no HTML to parse, no risk of breaking when someone redesigns the page. Scraping is the fallback for when no API exists.

When there's no API, quotes.toscrape.com is what this series uses throughout — it's maintained by Zyte (the company behind the Scrapy framework) explicitly as a sandbox for learning to scrape, with a stable, simple structure and no rate limits designed to catch you out. Practicing here first means the mistakes you make are cheap ones.

For a real target, two things to check before writing any code:

Reading robots.txt before you write a line of code

Most sites publish a robots.txt at their root that tells automated clients which paths they'd rather bots stay out of:

bash
curl https://example.com/robots.txt
text
User-agent: *
Disallow: /admin/
Disallow: /search
Crawl-delay: 5

Sitemap: https://example.com/sitemap.xml

User-agent: * means "these rules apply to every bot" (a specific bot name instead of * scopes the rules to just that one). Disallow paths are the ones the site is asking automated clients to skip — robots.txt is a request, not a technical lock, but ignoring it is exactly the kind of thing that gets an IP range blocked. Crawl-delay, when present, is the minimum seconds the site is asking you to wait between requests — treat it as a floor, not a suggestion to hit exactly.

A note on legality

This isn't legal advice, and "technically possible" isn't the same as "allowed." Scraping public data you could already see by visiting the page in a browser is generally treated very differently from scraping data behind a login or ignoring an explicit Terms of Service prohibition. When in doubt on a real target, that's a question for someone qualified to answer it — not a robots.txt file.

Setting up the project

bash
mkdir quote-scraper && cd quote-scraper
python3 -m venv venv
source venv/bin/activate
pip install requests beautifulsoup4 lxml

Three packages cover this entire series: requests to fetch pages, beautifulsoup4 to parse them, and lxml as the fast HTML parser BeautifulSoup delegates to. Freeze them once the project works:

bash
pip freeze > requirements.txt

Next up: actually fetching a page — and the one header most tutorials skip that gets real scrapers blocked on real sites.

VK

Vijay Kumar

Founder of TechPurAI — writing hands-on tutorials and honest tool breakdowns.

LinkedIn ↗
next →2. Fetching pages reliably with requests