Rate Limiting Sandbox

This page is protected by server-side rate limiting. If you send more than 10 requests in 10 seconds, the server will respond with HTTP 429 Too Many Requests. Perfect for practicing how real-world scrapers handle throttling and build retry logic.

Server-side enforced10 req / 10 sec429 after limit

Window Limit

10

Maximum requests allowed per 10-second window.

Penalty Response

429

HTTP status returned when the limit is exceeded.

Practice Goal

Back Off

Implement retry logic with exponential backoff.

How to Handle Rate Limits in Your Scraper

1. Detect 429 Status

Check for HTTP 429 status codes in your scraper responses and read the Retry-After header if provided by the server.

2. Exponential Backoff

Wait progressively longer between retries: 1s → 2s → 4s → 8s to avoid repeatedly hitting the same limit.

3. Respect Limits

Add polite delays between requests and respect robots.txt rules to build sustainable scrapers.

Example: Python with exponential backoff
import time, requests

def fetch_with_backoff(url, max_retries=5):
    for attempt in range(max_retries):
        response = requests.get(url)
        if response.status_code == 429:
            wait = 2 ** attempt
            print(f"Rate limited. Retrying in {wait}s...")
            time.sleep(wait)
        else:
            return response
    raise Exception("Max retries exceeded")