# HttpClientAsync<!-- -->

Abstract base class for asynchronous HTTP clients used by `ApifyClientAsync`.

Extend this class to create a custom asynchronous HTTP client. See `HttpClient` for details on the expected behavior.

### Hierarchy

* [HttpClientBase](https://docs.apify.com/api/client/python/api/client/python/reference/class/HttpClientBase.md)
  * *HttpClientAsync*
    * [ImpitHttpClientAsync](https://docs.apify.com/api/client/python/api/client/python/reference/class/ImpitHttpClientAsync.md)

## Index[**](#Index)

### Methods

* [**\_\_init\_\_](https://docs.apify.com/api/client/python/api/client/python/reference/class/HttpClientAsync.md#__init__)
* [**call](https://docs.apify.com/api/client/python/api/client/python/reference/class/HttpClientAsync.md#call)

## Methods<!-- -->[**](#Methods)

### [**](#__init__)\_\_init\_\_

* ****\_\_init\_\_**(\*, token, timeout\_short, timeout\_medium, timeout\_long, timeout\_max, max\_retries, min\_delay\_between\_retries, statistics, headers): None

- Inherited from [HttpClientBase.\_\_init\_\_](https://docs.apify.com/api/client/python/api/client/python/reference/class/HttpClientBase.md#__init__)

  Initialize the HTTP client base.

  ***

  #### Parameters

  * ##### optionalkeyword-onlytoken: str | None = <!-- -->None

    Apify API token for authentication.

  * ##### optionalkeyword-onlytimeout\_short: timedelta = <!-- -->DEFAULT\_TIMEOUT\_SHORT

    Default timeout for short-duration API operations (simple CRUD operations, ...).

  * ##### optionalkeyword-onlytimeout\_medium: timedelta = <!-- -->DEFAULT\_TIMEOUT\_MEDIUM

    Default timeout for medium-duration API operations (batch operations, listing, ...).

  * ##### optionalkeyword-onlytimeout\_long: timedelta = <!-- -->DEFAULT\_TIMEOUT\_LONG

    Default timeout for long-duration API operations (long-polling, streaming, ...).

  * ##### optionalkeyword-onlytimeout\_max: timedelta = <!-- -->DEFAULT\_TIMEOUT\_MAX

    Maximum timeout cap for exponential timeout growth across retries.

  * ##### optionalkeyword-onlymax\_retries: int = <!-- -->DEFAULT\_MAX\_RETRIES

    Maximum number of retries for failed requests.

  * ##### optionalkeyword-onlymin\_delay\_between\_retries: timedelta = <!-- -->DEFAULT\_MIN\_DELAY\_BETWEEN\_RETRIES

    Minimum delay between retries.

  * ##### optionalkeyword-onlystatistics: ClientStatistics | None = <!-- -->None

    Statistics tracker for API calls. Created automatically if not provided.

  * ##### optionalkeyword-onlyheaders: dict\[str, str] | None = <!-- -->None

    Additional HTTP headers to include in all requests.

  #### Returns None

### [**](#call)call

* **async **call**(\*, method, url, headers, params, data, json, stream, timeout): [HttpResponse](https://docs.apify.com/api/client/python/api/client/python/reference/class/HttpResponse.md)

- Make an HTTP request.

  ***

  #### Parameters

  * ##### keyword-onlymethod: str

    HTTP method (GET, POST, PUT, DELETE, etc.).

  * ##### keyword-onlyurl: str

    Full URL to make the request to.

  * ##### optionalkeyword-onlyheaders: dict\[str, str] | None = <!-- -->None

    Additional headers to include in this request.

  * ##### optionalkeyword-onlyparams: dict\[str, Any] | None = <!-- -->None

    Query parameters to append to the URL.

  * ##### optionalkeyword-onlydata: ((str | bytes) | bytearray) | None = <!-- -->None

    Raw request body data. Cannot be used together with json.

  * ##### optionalkeyword-onlyjson: Any = <!-- -->None

    JSON-serializable data for the request body. Cannot be used together with data.

  * ##### optionalkeyword-onlystream: bool | None = <!-- -->None

    Whether to stream the response body.

  * ##### optionalkeyword-onlytimeout: [Timeout](https://docs.apify.com/api/client/python/api/client/python/reference.md#Timeout) = <!-- -->'medium'

    Timeout for the API HTTP request. Use `short`, `medium`, or `long` tier literals for preconfigured timeouts. A `timedelta` overrides it for this call, and `no_timeout` disables the timeout entirely.

  #### Returns [HttpResponse](https://docs.apify.com/api/client/python/api/client/python/reference/class/HttpResponse.md)

  The HTTP response object.
