Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

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

NameWhat it does
ClientAsyncClient is HTTPX’s reusable asynchronous client for making HTTP requests. It provides connection pooling and related client features and can be shared between tasks.
AsyncClientHTTPX 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().
ResponseHTTPX 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.
Requesthttpx.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.
LimitsClass
TimeoutHTTPX Timeout configures maximum waiting periods for connection, reading, writing, and connection-pool acquisition. Set one default value or override individual phases with named arguments.
URLClass

Function

NameWhat it does
httpx.getSends 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.postSends 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.
streamStreams 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.
getAsyncClient.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.
acloseAsyncClient.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