httpx API reference
104 public APIs from httpx (encode/httpx) — 42 classes, 4 functions, 58 methods. Signatures extracted by static analysis of the actual source.
Repository: encode/httpx
| Kind | Count |
|---|---|
| Classes | 42 |
| Functions | 4 |
| Methods | 58 |
API list
class
httpx._auth.AuthBase class for all authentication schemes.
method
httpx._auth.Auth.async_auth_flow(request:Request) -> typing.AsyncGenerator[Request, Response]Execute the authentication flow asynchronously.
method
httpx._auth.Auth.auth_flow(request:Request) -> typing.Generator[Request, Response, None]Execute the authentication flow.
method
httpx._auth.Auth.sync_auth_flow(request:Request) -> typing.Generator[Request, Response, None]Execute the authentication flow synchronously.
method
httpx._client.AsyncClient.aclose() -> NoneClose transport and proxies.
method
httpx._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
httpx._client.BaseClient.base_url() -> URLBase URL to use when sending requests with relative URLs.
method
httpx._client.BaseClient.cookies() -> CookiesCookie values to include when sending requests.
method
httpx._client.BaseClient.headers() -> HeadersHTTP headers to include when sending requests.
method
httpx._client.BaseClient.is_closed() -> boolCheck if the client being closed
method
httpx._client.Client.close() -> NoneClose transport and proxies.
method
httpx._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
httpx._config.LimitsConfiguration for limits to various client behaviors.
class
httpx._config.TimeoutTimeout configuration.
class
httpx._decoders.BrotliDecoderHandle 'brotli' decoding.
class
httpx._decoders.ByteChunkerHandles returning byte content in fixed-size chunks.
class
httpx._decoders.DeflateDecoderHandle 'deflate' decoding.
class
httpx._decoders.GZipDecoderHandle 'gzip' decoding.
class
httpx._decoders.IdentityDecoderHandle unencoded data.
class
httpx._decoders.LineDecoderHandles incrementally reading lines from text.
class
httpx._decoders.MultiDecoderHandle the case where multiple encodings have been applied.
class
httpx._decoders.TextChunkerHandles returning text content in fixed-size chunks.
class
httpx._decoders.TextDecoderHandles incrementally decoding bytes into text
class
httpx._decoders.ZStandardDecoderHandle 'zstd' RFC 8878 decoding.
class
httpx._exceptions.CloseErrorFailed to close a connection.
class
httpx._exceptions.ConnectErrorFailed to establish a connection.
class
httpx._exceptions.ConnectTimeoutTimed out while connecting to the host.
class
httpx._exceptions.DecodingErrorDecoding of the response failed, due to a malformed encoding.
class
httpx._exceptions.HTTPErrorBase class for `RequestError` and `HTTPStatusError`.
class
httpx._exceptions.HTTPStatusErrorThe response had an error HTTP status of 4xx or 5xx.
class
httpx._exceptions.InvalidURLURL is improperly formed or cannot be parsed.
class
httpx._exceptions.LocalProtocolErrorA protocol was violated by the client.
class
httpx._exceptions.NetworkErrorThe base class for network-related errors.
class
httpx._exceptions.PoolTimeoutTimed out waiting to acquire a connection from the pool.
class
httpx._exceptions.ProtocolErrorThe protocol was violated.
class
httpx._exceptions.ProxyErrorAn error occurred while establishing a proxy connection.
class
httpx._exceptions.ReadErrorFailed to receive data from the network.
class
httpx._exceptions.ReadTimeoutTimed out while receiving data from the host.
class
httpx._exceptions.RemoteProtocolErrorThe protocol was violated by the server.
class
httpx._exceptions.RequestErrorBase class for all exceptions that may occur when issuing a `.request()`.
class
httpx._exceptions.StreamErrorThe base class for stream exceptions.
class
httpx._exceptions.TimeoutExceptionThe base class for timeout errors.
class
httpx._exceptions.TooManyRedirectsToo many redirects.
class
httpx._exceptions.TransportErrorBase class for all exceptions that occur at the level of the Transport API.
class
httpx._exceptions.UnsupportedProtocolAttempted to make a request to an unsupported protocol.
class
httpx._exceptions.WriteErrorFailed to send data through the network.
class
httpx._exceptions.WriteTimeoutTimed out while sending data to the host.
class
httpx._models.CookiesHTTP Cookies, as a mutable mapping.
method
httpx._models.Cookies.clear(domain:str | None=None, path:str | None=None) -> NoneDelete all cookies.
method
httpx._models.Cookies.delete(name:str, domain:str | None=None, path:str | None=None) -> NoneDelete a cookie by name.
method
httpx._models.Cookies.extract_cookies(response:Response) -> NoneLoads any cookies based on the response `Set-Cookie` headers.
method
httpx._models.Cookies.get(name:str, default:str | None=None, domain:str | None=None, path:str | None=None) -> str | NoneGet a cookie by name.
method
httpx._models.Cookies.set(name:str, value:str, domain:str='', path:str='/') -> NoneSet a cookie value by name.
method
httpx._models.Cookies.set_cookie_header(request:Request) -> NoneSets an appropriate 'Cookie:' HTTP header on the `Request`.
class
httpx._models.HeadersHTTP headers, as a case-insensitive multi-dict.
method
httpx._models.Headers.get(key:str, default:typing.Any=None) -> typing.AnyReturn a header value.
method
httpx._models.Headers.get_list(key:str, split_commas:bool=False) -> list[str]Return a list of all header values for a given key.
method
httpx._models.Headers.items() -> typing.ItemsView[str, str]Return `(key, value)` items of headers.
method
httpx._models.Headers.multi_items() -> list[tuple[str, str]]Return a list of `(key, value)` pairs of headers.
method
httpx._models.Headers.raw() -> list[tuple[bytes, bytes]]Returns a list of the raw header items, as byte pairs.
method
httpx._models.Request.aread() -> bytesRead and return the request content.
method
httpx._models.Request.read() -> bytesRead and return the request content.
method
httpx._models.Response.aclose() -> NoneClose the response and release the connection.
method
httpx._models.Response.aiter_bytes(chunk_size:int | None=None) -> typing.AsyncIterator[bytes]A byte-iterator over the decoded response content.
method
httpx._models.Response.aiter_raw(chunk_size:int | None=None) -> typing.AsyncIterator[bytes]A byte-iterator over the raw response content.
method
httpx._models.Response.aread() -> bytesRead and return the response content.
method
httpx._models.Response.close() -> NoneClose the response and release the connection.
method
httpx._models.Response.iter_bytes(chunk_size:int | None=None) -> typing.Iterator[bytes]A byte-iterator over the decoded response content.
method
httpx._models.Response.iter_raw(chunk_size:int | None=None) -> typing.Iterator[bytes]A byte-iterator over the raw response content.
method
httpx._models.Response.raise_for_status() -> ResponseRaise the `HTTPStatusError` if one occurred.
method
httpx._models.Response.read() -> bytesRead and return the response content.
method
httpx._models.Response.url() -> URLReturns the URL for which the request was made.
class
httpx._multipart.DataFieldA single form field item, within a multipart form field.
class
httpx._multipart.FileFieldA single file field item, within a multipart form field.
class
httpx._multipart.MultipartStreamRequest content as streaming multipart encoded form data.
method
httpx._transports.base.BaseTransport.handle_request(request:Request) -> ResponseSend a single HTTP request and return a response.
func
httpx._urlparse.normalize_path(path:str) -> strDrop "." and ".." segments from a URL path.
func
httpx._urlparse.percent_encoded(string:str, safe:str) -> strUse percent-encoding to quote a string.
class
httpx._urls.QueryParamsURL query parameters, as a multi-dict.
method
httpx._urls.QueryParams.get(key:typing.Any, default:typing.Any=None) -> typing.AnyGet a value from the query param for a given key.
method
httpx._urls.QueryParams.get_list(key:str) -> list[str]Get all values from the query param for a given key.
method
httpx._urls.QueryParams.items() -> typing.ItemsView[str, str]Return all items in the query params.
method
httpx._urls.QueryParams.keys() -> typing.KeysView[str]Return all the keys in the query params.
method
httpx._urls.QueryParams.merge(params:QueryParamTypes | None=None) -> QueryParamsReturn a new QueryParams instance, updated with.
method
httpx._urls.QueryParams.multi_items() -> list[tuple[str, str]]Return all items in the query params.
method
httpx._urls.QueryParams.remove(key:str) -> QueryParamsReturn a new QueryParams instance, removing the value of a key.
method
httpx._urls.QueryParams.set(key:str, value:typing.Any=None) -> QueryParamsReturn a new QueryParams instance, setting the value of a key.
method
httpx._urls.QueryParams.values() -> typing.ValuesView[str]Return all the values in the query params.
method
httpx._urls.URL.copy_with(**kwargs:typing.Any) -> URLCopy this URL, returning a new URL with some components altered.
method
httpx._urls.URL.fragment() -> strThe URL fragments, as used in HTML anchors.
method
httpx._urls.URL.host() -> strThe URL host as a string.
method
httpx._urls.URL.join(url:URL | str) -> URLReturn an absolute URL, using this URL as the base.
method
httpx._urls.URL.netloc() -> bytesEither `<host>` or `<host>:<port>` as bytes.
method
httpx._urls.URL.password() -> strThe URL password as a string, with URL decoding applied.
method
httpx._urls.URL.path() -> strThe URL path as a string.
method
httpx._urls.URL.port() -> int | NoneThe URL port as an integer.
method
httpx._urls.URL.query() -> bytesThe URL query string, as raw bytes, excluding the leading b"?".
method
httpx._urls.URL.raw_host() -> bytesThe raw bytes representation of the URL host.
method
httpx._urls.URL.raw_path() -> bytesThe complete URL path and query string as raw bytes.
method
httpx._urls.URL.scheme() -> strThe URL scheme, such as "http", "https".
method
httpx._urls.URL.userinfo() -> bytesThe URL userinfo as a raw bytestring.
method
httpx._urls.URL.username() -> strThe URL username as a string, with URL decoding applied.
func
httpx._utils.get_environment_proxies() -> dict[str, str | None]Gets proxy information from the environment
func
httpx._utils.primitive_value_to_str(value:PrimitiveData) -> strCoerce a primitive data type into a string value.
About this data
These signatures were extracted from the public source of encode/httpx
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.