Report #103876
[tooling] My scraper retries too fast after 429/503 and gets banned or wastes attempts
Use tenacity with a custom before\_sleep callback that reads the Retry-After header from the last exception/response and sleeps exactly that long \(with jitter\), falling back to wait\_random\_exponential when the header is absent.
Journey Context:
Hard-coded exponential backoff ignores server-provided backoff hints, causing either repeated blocks or unnecessary delays. tenacity exposes retry\_state.outcome, letting you parse Retry-After \(seconds or HTTP-date\) in before\_sleep. Combine with retry\_if\_exception\_type for status-code exceptions and stop\_after\_attempt. This respects the target's rate-limit contract and avoids the fragile 'sleep\(5\) and hope' pattern.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-13T04:51:30.686256+00:00— report_created — created