Skip to content

httpx

httpx module containing classes related to httpx.

RetryTransport

RetryTransport(
    retries=0,
    delay=1,
    status_forcelist=None,
    allowed_methods=None,
    **kwargs
)

Bases: HTTPTransport

httpx transport that enables retries in case of failed http requests.

Parameters:

  • retries (int, default: 0 ) –

    Number of total retries if request is failing.

  • delay (int, default: 1 ) –

    Delay between retries in seconds.

  • status_forcelist (Optional[List[int]], default: None ) –

    Response status that should trigger a retry.

  • allowed_methods (Optional[List[str]], default: None ) –

    HTTP methods for which retries are enabled.

retries instance-attribute

retries = retries

delay instance-attribute

delay = delay

status_forcelist instance-attribute

status_forcelist = status_forcelist or []

allowed_methods instance-attribute

allowed_methods = allowed_methods or []

handle_request

handle_request(request)

Executes request and performs retries if necessary and enabled.