How pydantic/httpx2 works
HTTPX2 is a Python HTTP client backed by the separate httpcore2 transport package. Its main workflow is to accept a request through the public API or client, prepare request/model and configuration state, dispatch through a transport, and return a decoded response. The README also documents a CLI, WebSockets, WSGI/ASGI transports, and HTTP/1.1 and HTTP/2. Some links below are README-supported; source excerpts and the SOURCE INDEX establish the sampled implementation relationships, but unsampled modules are represented only where their paths are in the tree.
Main entry points: _client.py Client orchestration · _models.py Requests and responses · __init__.py HTTP core API · connection_pool.py Sync connection pool
Components 23
HTTPX client
- Top-level API
src/httpx2/httpx2/_api.py - Client orchestration
src/httpx2/httpx2/_client.py - Requests and responses
src/httpx2/httpx2/_models.py - URL handling
src/httpx2/httpx2/_urls.py - Timeout and TLS config
src/httpx2/httpx2/_config.py
Transport and protocols
- Transport interface
src/httpx2/httpx2/_transports/base.py - Default transport
src/httpx2/httpx2/_transports/default.py - WSGI and ASGI
src/httpx2/httpx2/_transports/asgi.py
Network runtime
- HTTP core API
src/httpcore2/httpcore2/__init__.py - Sync connection pool
src/httpcore2/httpcore2/_sync/connection_pool.py - Async connection pool
src/httpcore2/httpcore2/_async/connection_pool.py - Sync HTTP protocols
src/httpcore2/httpcore2/_sync/http11.py - Async HTTP protocols
src/httpcore2/httpcore2/_async/http11.py - Network backends
src/httpcore2/httpcore2/_backends/base.py - HTTP/2 protocol
src/httpcore2/httpcore2/_async/http2.py
Client capabilities
- Authentication
src/httpx2/httpx2/_auth.py - Body encoding and decoding
src/httpx2/httpx2/_content.py - Multipart uploads
src/httpx2/httpx2/_multipart.py - Server-sent events
src/httpx2/httpx2/_sse.py - WebSockets
src/httpx2/httpx2/websockets/_api.py - Command-line client
src/httpx2/httpx2/_main.py
Other components
- Python caller
- HTTP server
Connections 26
- Python caller → Top-level API: calls
- Top-level API → Client orchestration: creates client
- Client orchestration → Requests and responses: builds requests
src/httpx2/httpx2/_client.py - Client orchestration → Timeout and TLS config: uses settings
src/httpx2/httpx2/_client.py - Client orchestration → Authentication: applies auth
src/httpx2/httpx2/_client.py - Client orchestration → Server-sent events: supports SSE
src/httpx2/httpx2/_client.py - Client orchestration → WebSockets: exposes WebSockets
src/httpx2/httpx2/_client.py - Client orchestration → Transport interface: dispatches requests
src/httpx2/httpx2/_client.py - Requests and responses → URL handling: uses URL types
src/httpx2/httpx2/_models.py - Requests and responses → Body encoding and decoding: encodes bodies
src/httpx2/httpx2/_models.py - Requests and responses → Multipart uploads: builds multipart
src/httpx2/httpx2/_models.py - Default transport → Transport interface: implements
src/httpx2/httpx2/_transports/default.py - Client orchestration → Default transport: uses by default
src/httpx2/httpx2/_client.py - Client orchestration → WSGI and ASGI: supports app transports
README.md - Python caller → Command-line client: invokes
README.md - Transport interface → HTTP core API: uses transport core
- HTTP core API → Sync connection pool: offers sync pool
src/httpcore2/httpcore2/__init__.py - HTTP core API → Async connection pool: offers async pool
src/httpcore2/httpcore2/__init__.py - Sync connection pool → Sync HTTP protocols: dispatches protocols
- Async connection pool → Async HTTP protocols: dispatches protocols
- Sync connection pool → Network backends: uses backend
src/httpcore2/httpcore2/_sync/connection_pool.py - Async connection pool → Network backends: uses backend
src/httpcore2/httpcore2/_async/connection_pool.py - Async HTTP protocols → HTTP/2 protocol: supports HTTP/2
README.md - Sync HTTP protocols → HTTP/2 protocol: supports HTTP/2
README.md - Network backends → HTTP server: opens network streams
- HTTP server → Default transport: returns response