<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>149</id><slug>rate-limit-headers-explained-part-8-149</slug><title>Rate limit headers explained, part 8</title><excerpt>In part 8 we take the ideas from earlier instalments and apply them to a larger, messier site. A well-behaved API tells you how many requests you have left before it starts saying no. Reading those…</excerpt><seriesName>Rate limit headers explained</seriesName><seriesPart>8</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>In part 8 we take the ideas from earlier instalments and apply them to a larger, messier site. A well-behaved API tells you how many requests you have left before it starts saying no. Reading those headers turns rate limiting from a surprise into a plan.</item></paragraphs></item><item><heading>Common pitfalls</heading><paragraphs><item>Write small, focused tests for your parsers using saved HTML fixtures. They run in milliseconds and catch layout changes long before a full crawl would.</item><item>Be careful with relative URLs. Resolve every link against the page it came from, not against the site root, or you will request pages that do not exist.</item><item>Log every request with its URL, status code and duration. When something goes wrong at two in the morning, those logs are the difference between a quick fix and a long investigation.</item></paragraphs></item><item><heading>Step by step</heading><paragraphs><item>Keep configuration such as base URLs, delays and selectors out of your code. Changing a delay should not require a redeploy.</item><item>Dynamic pages render content after the initial HTML arrives. A browser automation tool can wait for a specific element to appear, which is far more reliable than sleeping for a fixed amount of time.</item><item>Time zones matter more than they seem. Store timestamps in UTC and convert only when displaying them.</item></paragraphs></item><item><heading>Key takeaway</heading><paragraphs><item>Track X-RateLimit-Remaining, slow down as it approaches zero, and when you receive a 429, wait for the number of seconds in Retry-After before trying again.</item></paragraphs></item></sections><authorId>10</authorId><authorName>Aisha Rossi</authorName><authorSlug>aisha-rossi</authorSlug><category>APIs</category><tags><item>testing</item></tags><publishedAt>2025-04-11T00:00:00.000Z</publishedAt><wordCount>228</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
