<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>144</id><slug>building-a-polite-scrapy-spider-part-8-144</slug><title>Building a polite Scrapy spider, part 8</title><excerpt>This is part 8 of our series, and this time we focus on edge cases readers asked about. Scrapy makes it very easy to send thousands of requests a minute. Making a spider that a site operator would be…</excerpt><seriesName>Building a polite Scrapy spider</seriesName><seriesPart>8</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>This is part 8 of our series, and this time we focus on edge cases readers asked about. Scrapy makes it very easy to send thousands of requests a minute. Making a spider that a site operator would be happy to see in their logs takes a few deliberate settings.</item></paragraphs></item><item><heading>What to watch for</heading><paragraphs><item>Always identify your client honestly with a descriptive User-Agent, and keep your request rate modest. A crawler that behaves like a considerate visitor is far less likely to cause problems for the site operator.</item><item>Store raw responses alongside parsed output while you are developing. When a parser breaks, you can replay the saved HTML instead of hitting the site again.</item></paragraphs></item><item><heading>Putting it into practice</heading><paragraphs><item>Before writing a single line of code, look at how the page actually loads its data. Open the network panel, reload, and note which requests return the content you care about. Very often the data you want arrives as JSON from an endpoint you can call directly.</item><item>Read the site's terms of service before you start. Many sites welcome automated access within limits and say so explicitly; others ask you to use an API instead.</item></paragraphs></item><item><heading>Key takeaway</heading><paragraphs><item>Turn on ROBOTSTXT_OBEY, set AutoThrottle, use a descriptive User-Agent with contact details, and cache responses while you develop.</item></paragraphs></item></sections><authorId>8</authorId><authorName>Hannah Novak</authorName><authorSlug>hannah-novak</authorSlug><category>Scraping Basics</category><tags><item>selenium</item><item>python</item><item>json</item><item>ethics</item></tags><publishedAt>2024-08-03T00:00:00.000Z</publishedAt><wordCount>203</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
