Description
When the API returns HTTP 429, the SDK should parse the Retry-After header (seconds) and either automatically wait and retry (if within max_retries) or raise RateLimitError with the wait time attached. The caller should never need to implement their own 429 backoff.
Proposed Steps
- In the response parser, detect HTTP 429 before raising a generic error.
- Parse
Retry-After header (integer seconds) and attach it to the RateLimitError.
- If auto-retry is enabled and
max_retries is not exhausted, sleep for retry_after seconds then retry.
- In the async client, use
asyncio.sleep instead of time.sleep.
Acceptance Criteria
- A 429 response raises
RateLimitError with a retry_after attribute.
- When retrying, the client waits at least
Retry-After seconds before the next attempt.
- If
Retry-After is absent, the client falls back to exponential backoff.
- Async client uses non-blocking sleep.
Description
When the API returns HTTP 429, the SDK should parse the
Retry-Afterheader (seconds) and either automatically wait and retry (if withinmax_retries) or raiseRateLimitErrorwith the wait time attached. The caller should never need to implement their own 429 backoff.Proposed Steps
Retry-Afterheader (integer seconds) and attach it to theRateLimitError.max_retriesis not exhausted, sleep forretry_afterseconds then retry.asyncio.sleepinstead oftime.sleep.Acceptance Criteria
RateLimitErrorwith aretry_afterattribute.Retry-Afterseconds before the next attempt.Retry-Afteris absent, the client falls back to exponential backoff.