Skip to content

HTTP reference


HTTPClientManager

A class for managing HTTP clients. This is available as the Application.http property.

client

client(**kwargs: Any) -> HTTPClient

Returns:

Type Description
HTTPClient

An HTTPClient instance with proper default configuration.

Other Parameters:

Name Type Description
**kwargs Any

Additional keyword arguments to pass to the get_http_client function.

HTTPClient

Bases: Client

A subclass of httpx.Client that intelligently retries requests.

Warning

This class should never be used directly. Instead, use the get_http_client function.

get_http_client

get_http_client(**kwargs: Any) -> HTTPClient

Prefer using the Application.http property instead.

with app.http.client() as client:
    client.get("https://example.com")

Returns:

Type Description
HTTPClient

An HTTPClient instance with proper default configuration.

Other Parameters:

Name Type Description
**kwargs Any

Additional keyword arguments to pass to the HTTPClient constructor.