pydoc > httpx.Client

Help on class Client in httpx:

httpx.Client = class Client(httpx._client.BaseClient)
 |  httpx.Client(*, auth: 'AuthTypes | None' = None, params: 'QueryParamTypes | None' = None, headers: 'HeaderTypes | None' = None, cookies: 'CookieTypes | None' = None, verify: 'ssl.SSLContext | str | bool' = True, cert: 'CertTypes | None' = None, trust_env: 'bool' = True, http1: 'bool' = True, http2: 'bool' = False, proxy: 'ProxyTypes | None' = None, mounts: 'None | typing.Mapping[str, BaseTransport | None]' = None, timeout: 'TimeoutTypes' = Timeout(timeout=5.0), follow_redirects: 'bool' = False, limits: 'Limits' = Limits(max_connections=100, max_keepalive_connections=20, keepalive_expiry=5.0), max_redirects: 'int' = 20, event_hooks: 'None | typing.Mapping[str, list[EventHook]]' = None, base_url: 'URL | str' = '', transport: 'BaseTransport | None' = None, default_encoding: 'str | typing.Callable[[bytes], str]' = 'utf-8') -> 'None'
 |
 |  An HTTP client, with connection pooling, HTTP/2, redirects, cookie persistence, etc.
 |
 |  It can be shared between threads.
 |
 |  Usage:
 |
 |  ```python
 |  >>> client = httpx.Client()
 |  >>> response = client.get('https://example.org')
 |  ```
 |
 |  **Parameters:**
 |
 |  * **auth** - *(optional)* An authentication class to use when sending
 |  requests.
 |  * **params** - *(optional)* Query parameters to include in request URLs, as
 |  a string, dictionary, or sequence of two-tuples.
 |  * **headers** - *(optional)* Dictionary of HTTP headers to include when
 |  sending requests.
 |  * **cookies** - *(optional)* Dictionary of Cookie items to include when
 |  sending requests.
 |  * **verify** - *(optional)* Either `True` to use an SSL context with the
 |  default CA bundle, `False` to disable verification, or an instance of
 |  `ssl.SSLContext` to use a custom context.
 |  * **http2** - *(optional)* A boolean indicating if HTTP/2 support should be
 |  enabled. Defaults to `False`.
 |  * **proxy** - *(optional)* A proxy URL where all the traffic should be routed.
 |  * **timeout** - *(optional)* The timeout configuration to use when sending
 |  requests.
 |  * **limits** - *(optional)* The limits configuration to use.
 |  * **max_redirects** - *(optional)* The maximum number of redirect responses
 |  that should be followed.
 |  * **base_url** - *(optional)* A URL to use as the base when building
 |  request URLs.
 |  * **transport** - *(optional)* A transport class to use for sending requests
 |  over the network.
 |  * **trust_env** - *(optional)* Enables or disables usage of environment
 |  variables for configuration.
 |  * **default_encoding** - *(optional)* The default encoding to use for decoding
 |  response text, if no charset information is included in a response Content-Type
 |  header. Set to a callable for automatic character set detection. Default: "utf-8".
 |
 |  Method resolution order:
 |      Client
 |      httpx._client.BaseClient
 |      builtins.object
 |
 |  Methods defined here:
 |
 |  __enter__(self: 'T') -> 'T'
 |
 |  __exit__(self, exc_type: 'type[BaseException] | None' = None, exc_value: 'BaseException | None' = None, traceback: 'TracebackType | None' = None) -> 'None'
 |
 |  __init__(self, *, auth: 'AuthTypes | None' = None, params: 'QueryParamTypes | None' = None, headers: 'HeaderTypes | None' = None, cookies: 'CookieTypes | None' = None, verify: 'ssl.SSLContext | str | bool' = True, cert: 'CertTypes | None' = None, trust_env: 'bool' = True, http1: 'bool' = True, http2: 'bool' = False, proxy: 'ProxyTypes | None' = None, mounts: 'None | typing.Mapping[str, BaseTransport | None]' = None, timeout: 'TimeoutTypes' = Timeout(timeout=5.0), follow_redirects: 'bool' = False, limits: 'Limits' = Limits(max_connections=100, max_keepalive_connections=20, keepalive_expiry=5.0), max_redirects: 'int' = 20, event_hooks: 'None | typing.Mapping[str, list[EventHook]]' = None, base_url: 'URL | str' = '', transport: 'BaseTransport | None' = None, default_encoding: 'str | typing.Callable[[bytes], str]' = 'utf-8') -> 'None'
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  close(self) -> 'None'
 |      Close transport and proxies.
 |
 |  delete(self, url: 'URL | str', *, params: 'QueryParamTypes | None' = None, headers: 'HeaderTypes | None' = None, cookies: 'CookieTypes | None' = None, auth: 'AuthTypes | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, follow_redirects: 'bool | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, timeout: 'TimeoutTypes | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, extensions: 'RequestExtensions | None' = None) -> 'Response'
 |      Send a `DELETE` request.
 |
 |      **Parameters**: See `httpx.request`.
 |
 |  get(self, url: 'URL | str', *, params: 'QueryParamTypes | None' = None, headers: 'HeaderTypes | None' = None, cookies: 'CookieTypes | None' = None, auth: 'AuthTypes | UseClientDefault | None' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, follow_redirects: 'bool | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, timeout: 'TimeoutTypes | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, extensions: 'RequestExtensions | None' = None) -> 'Response'
 |      Send a `GET` request.
 |
 |      **Parameters**: See `httpx.request`.
 |
 |  head(self, url: 'URL | str', *, params: 'QueryParamTypes | None' = None, headers: 'HeaderTypes | None' = None, cookies: 'CookieTypes | None' = None, auth: 'AuthTypes | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, follow_redirects: 'bool | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, timeout: 'TimeoutTypes | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, extensions: 'RequestExtensions | None' = None) -> 'Response'
 |      Send a `HEAD` request.
 |
 |      **Parameters**: See `httpx.request`.
 |
 |  options(self, url: 'URL | str', *, params: 'QueryParamTypes | None' = None, headers: 'HeaderTypes | None' = None, cookies: 'CookieTypes | None' = None, auth: 'AuthTypes | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, follow_redirects: 'bool | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, timeout: 'TimeoutTypes | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, extensions: 'RequestExtensions | None' = None) -> 'Response'
 |      Send an `OPTIONS` request.
 |
 |      **Parameters**: See `httpx.request`.
 |
 |  patch(self, url: 'URL | str', *, content: 'RequestContent | None' = None, data: 'RequestData | None' = None, files: 'RequestFiles | None' = None, json: 'typing.Any | None' = None, params: 'QueryParamTypes | None' = None, headers: 'HeaderTypes | None' = None, cookies: 'CookieTypes | None' = None, auth: 'AuthTypes | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, follow_redirects: 'bool | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, timeout: 'TimeoutTypes | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, extensions: 'RequestExtensions | None' = None) -> 'Response'
 |      Send a `PATCH` request.
 |
 |      **Parameters**: See `httpx.request`.
 |
 |  post(self, url: 'URL | str', *, content: 'RequestContent | None' = None, data: 'RequestData | None' = None, files: 'RequestFiles | None' = None, json: 'typing.Any | None' = None, params: 'QueryParamTypes | None' = None, headers: 'HeaderTypes | None' = None, cookies: 'CookieTypes | None' = None, auth: 'AuthTypes | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, follow_redirects: 'bool | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, timeout: 'TimeoutTypes | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, extensions: 'RequestExtensions | None' = None) -> 'Response'
 |      Send a `POST` request.
 |
 |      **Parameters**: See `httpx.request`.
 |
 |  put(self, url: 'URL | str', *, content: 'RequestContent | None' = None, data: 'RequestData | None' = None, files: 'RequestFiles | None' = None, json: 'typing.Any | None' = None, params: 'QueryParamTypes | None' = None, headers: 'HeaderTypes | None' = None, cookies: 'CookieTypes | None' = None, auth: 'AuthTypes | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, follow_redirects: 'bool | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, timeout: 'TimeoutTypes | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, extensions: 'RequestExtensions | None' = None) -> 'Response'
 |      Send a `PUT` request.
 |
 |      **Parameters**: See `httpx.request`.
 |
 |  request(self, method: 'str', url: 'URL | str', *, content: 'RequestContent | None' = None, data: 'RequestData | None' = None, files: 'RequestFiles | None' = None, json: 'typing.Any | None' = None, params: 'QueryParamTypes | None' = None, headers: 'HeaderTypes | None' = None, cookies: 'CookieTypes | None' = None, auth: 'AuthTypes | UseClientDefault | None' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, follow_redirects: 'bool | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, timeout: 'TimeoutTypes | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, extensions: 'RequestExtensions | None' = None) -> 'Response'
 |      Build and send a request.
 |
 |      Equivalent to:
 |
 |      ```python
 |      request = client.build_request(...)
 |      response = client.send(request, ...)
 |      ```
 |
 |      See `Client.build_request()`, `Client.send()` and
 |      [Merging of configuration][0] for how the various parameters
 |      are merged with client-level configuration.
 |
 |      [0]: /advanced/clients/#merging-of-configuration
 |
 |  send(self, request: 'Request', *, stream: 'bool' = False, auth: 'AuthTypes | UseClientDefault | None' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, follow_redirects: 'bool | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>) -> 'Response'
 |      Send a request.
 |
 |      The request is sent as-is, unmodified.
 |
 |      Typically you'll want to build one with `Client.build_request()`
 |      so that any client-level configuration is merged into the request,
 |      but passing an explicit `httpx.Request()` is supported as well.
 |
 |      See also: [Request instances][0]
 |
 |      [0]: /advanced/clients/#request-instances
 |
 |  stream(self, method: 'str', url: 'URL | str', *, content: 'RequestContent | None' = None, data: 'RequestData | None' = None, files: 'RequestFiles | None' = None, json: 'typing.Any | None' = None, params: 'QueryParamTypes | None' = None, headers: 'HeaderTypes | None' = None, cookies: 'CookieTypes | None' = None, auth: 'AuthTypes | UseClientDefault | None' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, follow_redirects: 'bool | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, timeout: 'TimeoutTypes | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, extensions: 'RequestExtensions | None' = None) -> 'typing.Iterator[Response]'
 |      Alternative to `httpx.request()` that streams the response body
 |      instead of loading it into memory at once.
 |
 |      **Parameters**: See `httpx.request`.
 |
 |      See also: [Streaming Responses][0]
 |
 |      [0]: /quickstart#streaming-responses
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from httpx._client.BaseClient:
 |
 |  build_request(self, method: 'str', url: 'URL | str', *, content: 'RequestContent | None' = None, data: 'RequestData | None' = None, files: 'RequestFiles | None' = None, json: 'typing.Any | None' = None, params: 'QueryParamTypes | None' = None, headers: 'HeaderTypes | None' = None, cookies: 'CookieTypes | None' = None, timeout: 'TimeoutTypes | UseClientDefault' = <httpx._client.UseClientDefault object at 0x7fc1d05d00d0>, extensions: 'RequestExtensions | None' = None) -> 'Request'
 |      Build and return a request instance.
 |
 |      * The `params`, `headers` and `cookies` arguments
 |      are merged with any values set on the client.
 |      * The `url` argument is merged with any `base_url` set on the client.
 |
 |      See also: [Request instances][0]
 |
 |      [0]: /advanced/clients/#request-instances
 |
 |  ----------------------------------------------------------------------
 |  Readonly properties inherited from httpx._client.BaseClient:
 |
 |  is_closed
 |      Check if the client being closed
 |
 |  trust_env
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from httpx._client.BaseClient:
 |
 |  __dict__
 |      dictionary for instance variables (if defined)
 |
 |  __weakref__
 |      list of weak references to the object (if defined)
 |
 |  auth
 |      Authentication class used when none is passed at the request-level.
 |
 |      See also [Authentication][0].
 |
 |      [0]: /quickstart/#authentication
 |
 |  base_url
 |      Base URL to use when sending requests with relative URLs.
 |
 |  cookies
 |      Cookie values to include when sending requests.
 |
 |  event_hooks
 |
 |  headers
 |      HTTP headers to include when sending requests.
 |
 |  params
 |      Query parameters to include in the URL when sending requests.
 |
 |  timeout

Generated by phpman v4.9.29 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-21 00:37 @216.73.216.114
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^