Retries
Certain errors are automatically retried 2 times by default, with a short exponential backoff. The following errors are retried automatically:- Connection errors (network connectivity problems)
- 408 Request Timeout
- 409 Conflict
- 429 Rate Limit
- 500+ Internal Server errors
Configuring retries globally
You can configure retry settings when creating the client:max_retries=2.
Configuring retries per-request
You can also configure retries on a per-request basis usingwith_options():
Timeouts
By default, requests time out after 1 minute (60 seconds). You can configure this with thetimeout option.
Basic timeout configuration
Set a simple timeout in seconds:Granular timeout control
For more granular control, usehttpx.Timeout to configure different timeout values for different phases of the request:
Per-request timeouts
Override the timeout for specific requests:Handling timeout errors
When a request times out, anAPITimeoutError is thrown:
max_retries=0.