Respecting Retry-After Without Hidden Retry Loops
Independent demonstration — not client work (July 2026)
A bounded Python retry helper now accepts both legal Retry-After formats, avoids an extra final sleep, and has deterministic tests.
Problem
A common API wrapper retries HTTP 429 immediately or understands only integer seconds. It can intensify rate limiting, make tests slow, and hide the real attempt budget.
Approach
I separated header parsing from retry orchestration, supported delta-seconds and HTTP-date values, made the attempt limit explicit, and injected the sleep function so the regression suite never waits in real time.
Proof
Four standard-library tests cover a successful retry, HTTP-date parsing, malformed-header fallback, and the final-attempt boundary. Verification: python3 -m unittest -v test_retry_after.py.