sdkagent

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

KindCount
Classes42
Functions4
Methods58

API list

classhttpx._auth.Auth
Base class for all authentication schemes.
methodhttpx._auth.Auth.async_auth_flow(request:Request) -> typing.AsyncGenerator[Request, Response]
Execute the authentication flow asynchronously.
methodhttpx._auth.Auth.auth_flow(request:Request) -> typing.Generator[Request, Response, None]
Execute the authentication flow.
methodhttpx._auth.Auth.sync_auth_flow(request:Request) -> typing.Generator[Request, Response, None]
Execute the authentication flow synchronously.
methodhttpx._client.AsyncClient.aclose() -> None
Close transport and proxies.
methodhttpx._client.AsyncClient.send(request:Request, *stream:bool=False, *auth:AuthTypes | UseClientDefault | None=USE_CLIENT_DEFAULT, *follow_redirects:bool | UseClientDefault=USE_CLIENT_DEFAULT) -> Response
Send a request.
methodhttpx._client.BaseClient.base_url() -> URL
Base URL to use when sending requests with relative URLs.
methodhttpx._client.BaseClient.cookies() -> Cookies
Cookie values to include when sending requests.
methodhttpx._client.BaseClient.headers() -> Headers
HTTP headers to include when sending requests.
methodhttpx._client.BaseClient.is_closed() -> bool
Check if the client being closed
methodhttpx._client.Client.close() -> None
Close transport and proxies.
methodhttpx._client.Client.send(request:Request, *stream:bool=False, *auth:AuthTypes | UseClientDefault | None=USE_CLIENT_DEFAULT, *follow_redirects:bool | UseClientDefault=USE_CLIENT_DEFAULT) -> Response
Send a request.
classhttpx._config.Limits
Configuration for limits to various client behaviors.
classhttpx._config.Timeout
Timeout configuration.
classhttpx._decoders.BrotliDecoder
Handle 'brotli' decoding.
classhttpx._decoders.ByteChunker
Handles returning byte content in fixed-size chunks.
classhttpx._decoders.DeflateDecoder
Handle 'deflate' decoding.
classhttpx._decoders.GZipDecoder
Handle 'gzip' decoding.
classhttpx._decoders.IdentityDecoder
Handle unencoded data.
classhttpx._decoders.LineDecoder
Handles incrementally reading lines from text.
classhttpx._decoders.MultiDecoder
Handle the case where multiple encodings have been applied.
classhttpx._decoders.TextChunker
Handles returning text content in fixed-size chunks.
classhttpx._decoders.TextDecoder
Handles incrementally decoding bytes into text
classhttpx._decoders.ZStandardDecoder
Handle 'zstd' RFC 8878 decoding.
classhttpx._exceptions.CloseError
Failed to close a connection.
classhttpx._exceptions.ConnectError
Failed to establish a connection.
classhttpx._exceptions.ConnectTimeout
Timed out while connecting to the host.
classhttpx._exceptions.DecodingError
Decoding of the response failed, due to a malformed encoding.
classhttpx._exceptions.HTTPError
Base class for `RequestError` and `HTTPStatusError`.
classhttpx._exceptions.HTTPStatusError
The response had an error HTTP status of 4xx or 5xx.
classhttpx._exceptions.InvalidURL
URL is improperly formed or cannot be parsed.
classhttpx._exceptions.LocalProtocolError
A protocol was violated by the client.
classhttpx._exceptions.NetworkError
The base class for network-related errors.
classhttpx._exceptions.PoolTimeout
Timed out waiting to acquire a connection from the pool.
classhttpx._exceptions.ProtocolError
The protocol was violated.
classhttpx._exceptions.ProxyError
An error occurred while establishing a proxy connection.
classhttpx._exceptions.ReadError
Failed to receive data from the network.
classhttpx._exceptions.ReadTimeout
Timed out while receiving data from the host.
classhttpx._exceptions.RemoteProtocolError
The protocol was violated by the server.
classhttpx._exceptions.RequestError
Base class for all exceptions that may occur when issuing a `.request()`.
classhttpx._exceptions.StreamError
The base class for stream exceptions.
classhttpx._exceptions.TimeoutException
The base class for timeout errors.
classhttpx._exceptions.TooManyRedirects
Too many redirects.
classhttpx._exceptions.TransportError
Base class for all exceptions that occur at the level of the Transport API.
classhttpx._exceptions.UnsupportedProtocol
Attempted to make a request to an unsupported protocol.
classhttpx._exceptions.WriteError
Failed to send data through the network.
classhttpx._exceptions.WriteTimeout
Timed out while sending data to the host.
classhttpx._models.Cookies
HTTP Cookies, as a mutable mapping.
methodhttpx._models.Cookies.clear(domain:str | None=None, path:str | None=None) -> None
Delete all cookies.
methodhttpx._models.Cookies.delete(name:str, domain:str | None=None, path:str | None=None) -> None
Delete a cookie by name.
methodhttpx._models.Cookies.extract_cookies(response:Response) -> None
Loads any cookies based on the response `Set-Cookie` headers.
methodhttpx._models.Cookies.get(name:str, default:str | None=None, domain:str | None=None, path:str | None=None) -> str | None
Get a cookie by name.
methodhttpx._models.Cookies.set(name:str, value:str, domain:str='', path:str='/') -> None
Set a cookie value by name.
methodhttpx._models.Cookies.set_cookie_header(request:Request) -> None
Sets an appropriate 'Cookie:' HTTP header on the `Request`.
classhttpx._models.Headers
HTTP headers, as a case-insensitive multi-dict.
methodhttpx._models.Headers.get(key:str, default:typing.Any=None) -> typing.Any
Return a header value.
methodhttpx._models.Headers.get_list(key:str, split_commas:bool=False) -> list[str]
Return a list of all header values for a given key.
methodhttpx._models.Headers.items() -> typing.ItemsView[str, str]
Return `(key, value)` items of headers.
methodhttpx._models.Headers.multi_items() -> list[tuple[str, str]]
Return a list of `(key, value)` pairs of headers.
methodhttpx._models.Headers.raw() -> list[tuple[bytes, bytes]]
Returns a list of the raw header items, as byte pairs.
methodhttpx._models.Request.aread() -> bytes
Read and return the request content.
methodhttpx._models.Request.read() -> bytes
Read and return the request content.
methodhttpx._models.Response.aclose() -> None
Close the response and release the connection.
methodhttpx._models.Response.aiter_bytes(chunk_size:int | None=None) -> typing.AsyncIterator[bytes]
A byte-iterator over the decoded response content.
methodhttpx._models.Response.aiter_raw(chunk_size:int | None=None) -> typing.AsyncIterator[bytes]
A byte-iterator over the raw response content.
methodhttpx._models.Response.aread() -> bytes
Read and return the response content.
methodhttpx._models.Response.close() -> None
Close the response and release the connection.
methodhttpx._models.Response.iter_bytes(chunk_size:int | None=None) -> typing.Iterator[bytes]
A byte-iterator over the decoded response content.
methodhttpx._models.Response.iter_raw(chunk_size:int | None=None) -> typing.Iterator[bytes]
A byte-iterator over the raw response content.
methodhttpx._models.Response.raise_for_status() -> Response
Raise the `HTTPStatusError` if one occurred.
methodhttpx._models.Response.read() -> bytes
Read and return the response content.
methodhttpx._models.Response.url() -> URL
Returns the URL for which the request was made.
classhttpx._multipart.DataField
A single form field item, within a multipart form field.
classhttpx._multipart.FileField
A single file field item, within a multipart form field.
classhttpx._multipart.MultipartStream
Request content as streaming multipart encoded form data.
methodhttpx._transports.base.BaseTransport.handle_request(request:Request) -> Response
Send a single HTTP request and return a response.
funchttpx._urlparse.normalize_path(path:str) -> str
Drop "." and ".." segments from a URL path.
funchttpx._urlparse.percent_encoded(string:str, safe:str) -> str
Use percent-encoding to quote a string.
classhttpx._urls.QueryParams
URL query parameters, as a multi-dict.
methodhttpx._urls.QueryParams.get(key:typing.Any, default:typing.Any=None) -> typing.Any
Get a value from the query param for a given key.
methodhttpx._urls.QueryParams.get_list(key:str) -> list[str]
Get all values from the query param for a given key.
methodhttpx._urls.QueryParams.items() -> typing.ItemsView[str, str]
Return all items in the query params.
methodhttpx._urls.QueryParams.keys() -> typing.KeysView[str]
Return all the keys in the query params.
methodhttpx._urls.QueryParams.merge(params:QueryParamTypes | None=None) -> QueryParams
Return a new QueryParams instance, updated with.
methodhttpx._urls.QueryParams.multi_items() -> list[tuple[str, str]]
Return all items in the query params.
methodhttpx._urls.QueryParams.remove(key:str) -> QueryParams
Return a new QueryParams instance, removing the value of a key.
methodhttpx._urls.QueryParams.set(key:str, value:typing.Any=None) -> QueryParams
Return a new QueryParams instance, setting the value of a key.
methodhttpx._urls.QueryParams.values() -> typing.ValuesView[str]
Return all the values in the query params.
methodhttpx._urls.URL.copy_with(**kwargs:typing.Any) -> URL
Copy this URL, returning a new URL with some components altered.
methodhttpx._urls.URL.fragment() -> str
The URL fragments, as used in HTML anchors.
methodhttpx._urls.URL.host() -> str
The URL host as a string.
methodhttpx._urls.URL.join(url:URL | str) -> URL
Return an absolute URL, using this URL as the base.
methodhttpx._urls.URL.netloc() -> bytes
Either `<host>` or `<host>:<port>` as bytes.
methodhttpx._urls.URL.password() -> str
The URL password as a string, with URL decoding applied.
methodhttpx._urls.URL.path() -> str
The URL path as a string.
methodhttpx._urls.URL.port() -> int | None
The URL port as an integer.
methodhttpx._urls.URL.query() -> bytes
The URL query string, as raw bytes, excluding the leading b"?".
methodhttpx._urls.URL.raw_host() -> bytes
The raw bytes representation of the URL host.
methodhttpx._urls.URL.raw_path() -> bytes
The complete URL path and query string as raw bytes.
methodhttpx._urls.URL.scheme() -> str
The URL scheme, such as "http", "https".
methodhttpx._urls.URL.userinfo() -> bytes
The URL userinfo as a raw bytestring.
methodhttpx._urls.URL.username() -> str
The URL username as a string, with URL decoding applied.
funchttpx._utils.get_environment_proxies() -> dict[str, str | None]
Gets proxy information from the environment
funchttpx._utils.primitive_value_to_str(value:PrimitiveData) -> str
Coerce 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.

Back to all 805 libraries