pydoc > httpx.Client

📖 NAME

httpx.Client — An HTTP client with connection pooling, HTTP/2, redirects, cookie persistence, and more. It can be shared between threads.

🚀 Quick Reference

Use CaseCommandDescription
Create a clientclient = httpx.Client()Instantiate a client with default settings
Send a GET requestresponse = client.get('https://example.org')Fetch a resource
Send a POST requestresponse = client.post('https://example.org', json={'key': 'value'})Submit data as JSON
Send a PUT requestresponse = client.put('https://example.org', data='updated')Update a resource
Send a DELETE requestresponse = client.delete('https://example.org')Delete a resource
Send a PATCH requestresponse = client.patch('https://example.org', files={'file': open('data.txt', 'rb')})Partially update a resource
Send a HEAD requestresponse = client.head('https://example.org')Retrieve headers only
Send an OPTIONS requestresponse = client.options('https://example.org')Discover allowed methods
Stream a responsewith client.stream('GET', 'https://example.org') as r: ...Stream response body without loading into memory
Build a request manuallyrequest = client.build_request('GET', 'https://example.org')Create a request with client-level defaults merged
Send a pre-built requestresponse = client.send(request)Send a request as-is

🔧 Synopsis

class 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

📝 Description

An HTTP client with connection pooling, HTTP/2, redirects, cookie persistence, etc. It can be shared between threads.

Usage:

>>> client = httpx.Client()
>>> response = client.get('https://example.org')

⚙️ Constructor Parameters

🔧 Methods

📌 Methods defined here

📎 Methods inherited from httpx._client.BaseClient

🔍 Properties

📌 Readonly properties inherited from httpx._client.BaseClient

📂 Data descriptors inherited from httpx._client.BaseClient

Additionally, there are __dict__ and __weakref__ descriptors.

🔗 See Also

httpx.Client
📖 NAME 🚀 Quick Reference 🔧 Synopsis 📝 Description ⚙️ Constructor Parameters 🔧 Methods
📌 Methods defined here 📎 Methods inherited from httpx._client.BaseClient
🔍 Properties
📌 Readonly properties inherited from httpx._client.BaseClient 📂 Data descriptors inherited from httpx._client.BaseClient
🔗 See Also

Generated by phpman v4.9.27-5-g2cb901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-20 04:03 @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!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format

^_top_^