API reference
HTTPX API reference
HTTPX async HTTP client
- Identifiers
- 12
- With full guides
- 10
- Types
- 2
Topics covered
- Client & AsyncClient
- Requests
- Async requests
- Streaming
- Timeouts & limits
- Auth
- Proxies
- Testing
Class
| Name | What it does |
|---|---|
Client | AsyncClient is HTTPX’s reusable asynchronous client for making HTTP requests. It provides connection pooling and related client features and can be shared between tasks. |
AsyncClient | HTTPX AsyncClient is an asynchronous, reusable HTTP client with connection pooling and shared configuration. Use it with await and manage its lifetime with an async context manager or aclose(). |
Response | HTTPX Response represents the result of an HTTP request. It provides status and protocol metadata, headers, URL information, body access, status validation, and synchronous or asynchronous streaming operations. |
Request | httpx.Request is HTTPX’s low-level model for constructing an HTTP request before transmission. It is useful when request preparation and sending need to be separate. |
Limits | |
Timeout | HTTPX Timeout configures maximum waiting periods for connection, reading, writing, and connection-pool acquisition. Set one default value or override individual phases with named arguments. |
URL |
Function
| Name | What it does |
|---|---|
httpx.get | Sends a synchronous HTTP GET request using HTTPX's top-level API and returns its response. Optional arguments control query parameters, headers, authentication, redirects, TLS verification, timeouts, proxies, and environment settings. |
httpx.post | Sends a synchronous HTTP POST request and returns an httpx.Response. It supports multiple body encodings plus query parameters, headers, authentication, proxy, timeout, redirect, TLS, and environment settings. |
stream | Streams an asynchronous HTTP response instead of loading its entire body into memory at once. Use it as an async context block and consume the response with HTTPX async iterators. |
get | AsyncClient.get asynchronously performs an HTTP GET request and returns an HTTPX response. Await the call, and manage the client with an async context manager or explicit closure. |
aclose | AsyncClient.aclose() asynchronously closes the client's transport and proxies. Await it when explicitly managing an AsyncClient instead of relying on an async context manager. |
Search across every package and filter by type in your dashboard.
Start learning