Architecture of encode/httpx
encode/httpx is 98 source files holding 1,245 symbols across 2 modules, written mainly in Python. The largest module is tests, with 37 files, and 3 files are entry points into the dependency graph.
How httpx fits together
Input enters through the public API in httpx/__init__.py, a thin functional layer that forwards calls into the Client and AsyncClient classes. Those classes orchestrate each request, and shared core types keep inputs consistent between sync and async use. The actual sending is handled by transports in httpx/_transports, where httpx/_transports/base.py defines the common contract for all transports. BaseTransport and AsyncBaseTransport provide context manager hooks that make sure close() or aclose() is called. The httpx/_transports/asgi.py and httpx/_transports/wsgi.py files are the transports used when requests go directly to ASGI or WSGI applications. The result comes back as a response object carrying status codes, headers, cookies, streams, and any raised exceptions.
Largest modules
- tests: 37 files and 6,709 lines of code
- httpx: 23 files and 7,100 lines of code
Documentation
Repowise documents httpx in 135 pages generated from the source, 6 of them written explanations of the repository and its modules. Module guides include:
- httpx: HTTPX Client and Config
- httpx/_transports: Transport Backend Implementations
More on httpx: summary and FAQ, codebase overview, code health.