<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>69</id><slug>rate-limit-headers-explained-part-4-69</slug><title>Rate limit headers explained, part 4</title><excerpt>In part 4 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>4</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>In part 4 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>Going further</heading><paragraphs><item>Character encodings still cause trouble. Decode responses using the charset the server declares, and normalise text before comparing or storing it.</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><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></paragraphs></item><item><heading>Putting it into practice</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>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><item>Pagination comes in several shapes: numbered pages, next links, offsets and opaque cursors. Each has trade-offs, and a robust scraper should detect the end of the result set rather than assuming a fixed number of pages.</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>json</item><item>selenium</item></tags><publishedAt>2025-05-11T00:00:00.000Z</publishedAt><wordCount>250</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
