## download.retry_request()


Create a `tenacity` retry decorator for HTTP requests using the `requests` library.


Usage

``` python
download.retry_request(
    logger,
    *,
    extra_status_codes=frozenset(),
)
```


This decorator will automatically retry functions that make HTTP requests when they encounter transient network or server-side errors. It is a pre-configured `tenacity.retry` function with the following behaviors:

- `reraise=True` to see encountered exception at the end of the stack trace
- Retries `ConnectionError` and `Timeout` errors of the `requests` library, as well as HTTP Errors 408, 429, 502, 503, 504 (plus any status codes passed via `extra_status_codes`).
- Maximum attempts: 3
- Wait strategy: Exponential backoff with jitter (the latter for resolving contention between multiple processes)


## Parameters


`logger: logging.Logger`  
Logger instance used to log retry attempts before each sleep.

`extra_status_codes: frozenset of int = frozenset()`  
Additional HTTP status codes to treat as transient for this call site, on top of the codes in `TRANSIENT_HTTP_STATUS_CODES`. Use this rather than widening `TRANSIENT_HTTP_STATUS_CODES` itself when a status code (e.g. 500) is only known to be transient for one particular endpoint.


## Returns


`Callable[[WrappedFn], WrappedFn]`  
A tenacity retry decorator configured for HTTP request retries.
