httpx2 API reference
120 public APIs from httpx2 (pydantic/httpx2) — 58 classes, 5 functions, 57 methods. Signatures extracted by static analysis of the actual source.
Repository: pydantic/httpx2
| Kind | Count |
|---|---|
| Classes | 58 |
| Functions | 5 |
| Methods | 57 |
API list
class
src.httpcore2.httpcore2._async.connection_pool.AsyncConnectionPoolA connection pool for making HTTP requests.
method
src.httpcore2.httpcore2._async.connection_pool.AsyncConnectionPool.handle_async_request(request:Request) -> ResponseSend an HTTP request, and return an HTTP response.
class
src.httpcore2.httpcore2._models.RequestAn HTTP request.
class
src.httpcore2.httpcore2._models.ResponseAn HTTP response.
class
src.httpcore2.httpcore2._models.URLRepresents the URL against which an HTTP request may be made.
func
src.httpcore2.httpcore2._models.enforce_url(value:URL | bytes | str, *name:str) -> URLType check for URL parameters.
class
src.httpcore2.httpcore2._sync.connection_pool.ConnectionPoolA connection pool for making HTTP requests.
method
src.httpcore2.httpcore2._sync.connection_pool.ConnectionPool.handle_request(request:Request) -> ResponseSend an HTTP request, and return an HTTP response.
class
src.httpcore2.httpcore2._synchronization.AsyncLockThis is a standard lock.
class
src.httpcore2.httpcore2._synchronization.AsyncThreadLockThis is a threading-only lock for no-I/O contexts.
class
src.httpcore2.httpcore2._synchronization.LockThis is a standard lock.
class
src.httpcore2.httpcore2._synchronization.ThreadLockThis is a threading-only lock for no-I/O contexts.
class
src.httpx2.httpx2._auth.AuthBase class for all authentication schemes.
method
src.httpx2.httpx2._auth.Auth.async_auth_flow(request:Request) -> typing.AsyncGenerator[Request, Response]Execute the authentication flow asynchronously.
method
src.httpx2.httpx2._auth.Auth.auth_flow(request:Request) -> typing.Generator[Request, Response, None]Execute the authentication flow.
method
src.httpx2.httpx2._auth.Auth.sync_auth_flow(request:Request) -> typing.Generator[Request, Response, None]Execute the authentication flow synchronously.
method
src.httpx2.httpx2._client.AsyncClient.aclose() -> NoneClose transport and proxies.
method
src.httpx2.httpx2._client.AsyncClient.send(request:Request, *stream:bool=False, *auth:AuthTypes | UseClientDefault | None=USE_CLIENT_DEFAULT, *follow_redirects:bool | UseClientDefault=USE_CLIENT_DEFAULT) -> ResponseSend a request.
method
src.httpx2.httpx2._client.BaseClient.cookies() -> CookiesCookie values to include when sending requests.
method
src.httpx2.httpx2._client.BaseClient.headers() -> HeadersHTTP headers to include when sending requests.
method
src.httpx2.httpx2._client.BaseClient.is_closed() -> boolCheck if the client being closed
class
src.httpx2.httpx2._client.BoundSyncStreamA byte stream that tracks elapsed time for a response.
method
src.httpx2.httpx2._client.Client.close() -> NoneClose transport and proxies.
method
src.httpx2.httpx2._client.Client.send(request:Request, *stream:bool=False, *auth:AuthTypes | UseClientDefault | None=USE_CLIENT_DEFAULT, *follow_redirects:bool | UseClientDefault=USE_CLIENT_DEFAULT) -> ResponseSend a request.
class
src.httpx2.httpx2._config.LimitsConfiguration for limits to various client behaviors.
class
src.httpx2.httpx2._config.TimeoutTimeout configuration.
class
src.httpx2.httpx2._decoders.BrotliDecoderHandle 'brotli' decoding.
class
src.httpx2.httpx2._decoders.ByteChunkerHandles returning byte content in fixed-size chunks.
class
src.httpx2.httpx2._decoders.DeflateDecoderHandle 'deflate' decoding.
class
src.httpx2.httpx2._decoders.GZipDecoderHandle 'gzip' decoding.
class
src.httpx2.httpx2._decoders.IdentityDecoderHandle unencoded data.
class
src.httpx2.httpx2._decoders.LineDecoderHandles incrementally reading lines from text.
class
src.httpx2.httpx2._decoders.MultiDecoderHandle the case where multiple encodings have been applied.
class
src.httpx2.httpx2._decoders.TextChunkerHandles returning text content in fixed-size chunks.
class
src.httpx2.httpx2._decoders.TextDecoderHandles incrementally decoding bytes into text
class
src.httpx2.httpx2._decoders.ZStandardDecoderHandle 'zstd' RFC 8878 decoding.
class
src.httpx2.httpx2._exceptions.CloseErrorFailed to close a connection.
class
src.httpx2.httpx2._exceptions.ConnectErrorFailed to establish a connection.
class
src.httpx2.httpx2._exceptions.ConnectTimeoutTimed out while connecting to the host.
class
src.httpx2.httpx2._exceptions.DecodingErrorDecoding of the response failed, due to a malformed encoding.
class
src.httpx2.httpx2._exceptions.HTTPErrorBase class for `RequestError` and `HTTPStatusError`.
class
src.httpx2.httpx2._exceptions.HTTPStatusErrorThe response had an error HTTP status of 4xx or 5xx.
class
src.httpx2.httpx2._exceptions.HTTPXDeprecationWarningA custom deprecation warning for HTTPX.
class
src.httpx2.httpx2._exceptions.InvalidURLURL is improperly formed or cannot be parsed.
class
src.httpx2.httpx2._exceptions.LocalProtocolErrorA protocol was violated by the client.
class
src.httpx2.httpx2._exceptions.NetworkErrorThe base class for network-related errors.
class
src.httpx2.httpx2._exceptions.PoolTimeoutTimed out waiting to acquire a connection from the pool.
class
src.httpx2.httpx2._exceptions.ProtocolErrorThe protocol was violated.
class
src.httpx2.httpx2._exceptions.ProxyErrorAn error occurred while establishing a proxy connection.
class
src.httpx2.httpx2._exceptions.ReadErrorFailed to receive data from the network.
class
src.httpx2.httpx2._exceptions.ReadTimeoutTimed out while receiving data from the host.
class
src.httpx2.httpx2._exceptions.RemoteProtocolErrorThe protocol was violated by the server.
class
src.httpx2.httpx2._exceptions.RequestErrorBase class for all exceptions that may occur when issuing a `.request()`.
class
src.httpx2.httpx2._exceptions.StreamErrorThe base class for stream exceptions.
class
src.httpx2.httpx2._exceptions.TimeoutExceptionThe base class for timeout errors.
class
src.httpx2.httpx2._exceptions.TooManyRedirectsToo many redirects.
class
src.httpx2.httpx2._exceptions.TransportErrorBase class for all exceptions that occur at the level of the Transport API.
class
src.httpx2.httpx2._exceptions.UnsupportedProtocolAttempted to make a request to an unsupported protocol.
class
src.httpx2.httpx2._exceptions.WriteErrorFailed to send data through the network.
class
src.httpx2.httpx2._exceptions.WriteTimeoutTimed out while sending data to the host.
class
src.httpx2.httpx2._models.CookiesHTTP Cookies, as a mutable mapping.
method
src.httpx2.httpx2._models.Cookies.clear(domain:str | None=None, path:str | None=None) -> NoneDelete all cookies.
method
src.httpx2.httpx2._models.Cookies.delete(name:str, domain:str | None=None, path:str | None=None) -> NoneDelete a cookie by name.
method
src.httpx2.httpx2._models.Cookies.extract_cookies(response:Response) -> NoneLoads any cookies based on the response `Set-Cookie` headers.
method
src.httpx2.httpx2._models.Cookies.get(name:str, default:str | None=None, domain:str | None=None, path:str | None=None) -> str | NoneGet a cookie by name.
method
src.httpx2.httpx2._models.Cookies.set(name:str, value:str, domain:str='', path:str='/') -> NoneSet a cookie value by name.
method
src.httpx2.httpx2._models.Cookies.set_cookie_header(request:Request) -> NoneSets an appropriate 'Cookie:' HTTP header on the `Request`.
class
src.httpx2.httpx2._models.HeadersHTTP headers, as a case-insensitive multi-dict.
method
src.httpx2.httpx2._models.Headers.get(key:str, default:typing.Any=None) -> typing.AnyReturn a header value.
method
src.httpx2.httpx2._models.Headers.get_list(key:str, split_commas:bool=False) -> list[str]Return a list of all header values for a given key.
method
src.httpx2.httpx2._models.Headers.items() -> typing.ItemsView[str, str]Return `(key, value)` items of headers.
method
src.httpx2.httpx2._models.Headers.multi_items() -> list[tuple[str, str]]Return a list of `(key, value)` pairs of headers.
method
src.httpx2.httpx2._models.Request.aread() -> bytesRead and return the request content.
method
src.httpx2.httpx2._models.Request.read() -> bytesRead and return the request content.
method
src.httpx2.httpx2._models.Response.aclose() -> NoneClose the response and release the connection.
method
src.httpx2.httpx2._models.Response.aiter_bytes(chunk_size:int | None=None) -> typing.AsyncIterator[bytes]A byte-iterator over the decoded response content.
method
src.httpx2.httpx2._models.Response.aiter_raw(chunk_size:int | None=None) -> typing.AsyncIterator[bytes]A byte-iterator over the raw response content.
method
src.httpx2.httpx2._models.Response.aread() -> bytesRead and return the response content.
method
src.httpx2.httpx2._models.Response.close() -> NoneClose the response and release the connection.
method
src.httpx2.httpx2._models.Response.iter_bytes(chunk_size:int | None=None) -> typing.Iterator[bytes]A byte-iterator over the decoded response content.
method
src.httpx2.httpx2._models.Response.iter_raw(chunk_size:int | None=None) -> typing.Iterator[bytes]A byte-iterator over the raw response content.
method
src.httpx2.httpx2._models.Response.raise_for_status() -> ResponseRaise the `HTTPStatusError` if one occurred.
method
src.httpx2.httpx2._models.Response.read() -> bytesRead and return the response content.
method
src.httpx2.httpx2._models.Response.url() -> URLReturns the URL for which the request was made.
class
src.httpx2.httpx2._multipart.DataFieldA single form field item, within a multipart form field.
class
src.httpx2.httpx2._multipart.FileFieldA single file field item, within a multipart form field.
class
src.httpx2.httpx2._multipart.MultipartStreamRequest content as streaming multipart encoded form data.
method
src.httpx2.httpx2._transports.base.BaseTransport.handle_request(request:Request) -> ResponseSend a single HTTP request and return a response.
func
src.httpx2.httpx2._urlparse.normalize_path(path:str) -> strDrop "." and ".." segments from a URL path.
func
src.httpx2.httpx2._urlparse.percent_encoded(string:str, safe:str) -> strUse percent-encoding to quote a string.
class
src.httpx2.httpx2._urls.QueryParamsURL query parameters, as a multi-dict.
method
src.httpx2.httpx2._urls.QueryParams.get(key:typing.Any, default:typing.Any=None) -> typing.AnyGet a value from the query param for a given key.
method
src.httpx2.httpx2._urls.QueryParams.get_list(key:str) -> list[str]Get all values from the query param for a given key.
method
src.httpx2.httpx2._urls.QueryParams.items() -> typing.ItemsView[str, str]Return all items in the query params.
method
src.httpx2.httpx2._urls.QueryParams.keys() -> typing.KeysView[str]Return all the keys in the query params.
method
src.httpx2.httpx2._urls.QueryParams.merge(params:QueryParamTypes | None=None) -> QueryParamsReturn a new QueryParams instance, updated with.
method
src.httpx2.httpx2._urls.QueryParams.multi_items() -> list[tuple[str, str]]Return all items in the query params.
method
src.httpx2.httpx2._urls.QueryParams.remove(key:str) -> QueryParamsReturn a new QueryParams instance, removing the value of a key.
method
src.httpx2.httpx2._urls.QueryParams.set(key:str, value:typing.Any=None) -> QueryParamsReturn a new QueryParams instance, setting the value of a key.
method
src.httpx2.httpx2._urls.QueryParams.values() -> typing.ValuesView[str]Return all the values in the query params.
method
src.httpx2.httpx2._urls.URL.copy_with(**kwargs:typing.Any) -> URLCopy this URL, returning a new URL with some components altered.
method
src.httpx2.httpx2._urls.URL.fragment() -> strThe URL fragments, as used in HTML anchors.
method
src.httpx2.httpx2._urls.URL.host() -> strThe URL host as a string.
method
src.httpx2.httpx2._urls.URL.join(url:URL | str) -> URLReturn an absolute URL, using this URL as the base.
method
src.httpx2.httpx2._urls.URL.netloc() -> bytesEither `<host>` or `<host>:<port>` as bytes.
method
src.httpx2.httpx2._urls.URL.password() -> strThe URL password as a string, with URL decoding applied.
method
src.httpx2.httpx2._urls.URL.path() -> strThe URL path as a string.
method
src.httpx2.httpx2._urls.URL.port() -> int | NoneThe URL port as an integer.
method
src.httpx2.httpx2._urls.URL.raw_host() -> bytesThe raw bytes representation of the URL host.
method
src.httpx2.httpx2._urls.URL.raw_path() -> bytesThe complete URL path and query string as raw bytes.
method
src.httpx2.httpx2._urls.URL.scheme() -> strThe URL scheme, such as "http", "https".
method
src.httpx2.httpx2._urls.URL.userinfo() -> bytesThe URL userinfo as a raw bytestring.
method
src.httpx2.httpx2._urls.URL.username() -> strThe URL username as a string, with URL decoding applied.
func
src.httpx2.httpx2._utils.get_environment_proxies() -> dict[str, str | None]Gets proxy information from the environment
func
src.httpx2.httpx2._utils.primitive_value_to_str(value:PrimitiveData) -> strCoerce a primitive data type into a string value.
class
src.httpx2.httpx2.websockets._api.AsyncWebSocketClientAn async WebSocket client.
class
src.httpx2.httpx2.websockets._api.WebSocketClientA sync WebSocket client.
class
src.httpx2.httpx2.websockets._exceptions.HTTPXWSExceptionBase exception class for HTTPX WS.
class
src.httpx2.httpx2.websockets._exceptions.WebSocketDisconnectRaised when the server closed the WebSocket session.
class
src.httpx2.httpx2.websockets._exceptions.WebSocketInvalidTypeReceivedRaised when a event is not of the expected type.
About this data
These signatures were extracted from the public source of pydantic/httpx2
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.