API referencehttp
ovok_sdk.http.retry
When and how long to wait before retrying a request.
- Stable unknown
- Release candidate since 0.1.0-rc.4
- Development since 0.1.0-dev.25+2ba84b0
When and how long to wait before retrying a request.
RetryPolicy
RetryPolicy(max_retries: int, sleep: Sleep = time.sleep)Retries safe requests on network failures and 429, 502, 503 and 504, with backoff.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
max_retries | int | Retries allowed after the first attempt. | |
sleep | Sleep | time.sleep | Waits the given number of seconds. |
allows()
allows(request: HttpRequest, attempt: int) -> boolWhether request may be retried after failed attempt number attempt (0-based).
is_retryable_status()
is_retryable_status(status: int) -> boolWhether a response with status is worth retrying.
pause()
pause(attempt: int, retry_after_ms: int | None) -> NoneWait before the next attempt: retry_after_ms if given, else exponential backoff, at most 5 s.
retry_after_ms()
retry_after_ms(header: str | None) -> int | NoneReads Retry-After as seconds or an HTTP date; a past moment means now.
Returns
int | None: The delay in milliseconds, or None when the header is absent or unreadable.
Last updated on