http_error_middleware
HTTP error middleware.
Should be positioned as late as possible and before rate limiter middlewares (if any) in the client middlewares list.
Responses are handled differently based on their HTTP status:
Status | Measures |
---|---|
2XX | Return response. |
3XX | Raise aiohttp.ClientResponseError . |
4XX | Raise aiohttp.ClientResponseError . |
429 | Exponential retries (2^n). |
5XX | Exponential retries (2^n). |
Conn | Exponential retries (2^n). |
Example:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_retries
|
int
|
Number of retries to perform before giving up. |
3
|
Raises:
Type | Description |
---|---|
ClientResponseError
|
When retries have exhausted. |