Requests vs HTTPX
HTTPX vs Requests compared for 2026: Requests 2.34.2 (the default sync HTTP client for Python, now with inline types, Apache-2.0) vs HTTPX 0.28.1 (sync and async client with optional HTTP/2, strict default timeouts, BSD-3-Clause, no stable release since December 2024). Includes default-behaviour, throughput, concurrency, HTTP/2 and CPU results from runs we did on the same machine, the HTTPX 1.0 situation, and a clear pick.
Quick Answer
Requests is still the safe default for synchronous Python code: 2.34.2 (May 2026) added inline type hints, the API has not moved in a decade, and on our machine a requests.Session was as fast as an httpx.Client for sequential calls (1,029-1,082 vs 1,134-1,385 req/s on a local JSON endpoint). HTTPX wins when you need async, HTTP/2 or safer defaults: it times out after 5 seconds of network inactivity where Requests waits forever, it does not follow redirects silently, and it can call ASGI/WSGI apps in-process for tests. Three things we found that most comparisons miss. First, calling httpx.get() without a Client was 12x slower than requests.get() (60 vs 745 req/s) because every call builds a new client and SSL context (about 18 ms each in our run). Second, HTTPX's connection pool got CPU-bound at high concurrency: with 100 threads and max_keepalive_connections raised to 100, throughput fell to 48-62 req/s at 15-20 s of CPU per 1,000 requests, while Requests with 100 threads did 899 req/s on 0.67 s of CPU, and aiohttp did 867-925 req/s async on 0.2 s. At HTTPX's default limits it held up (867-881 req/s). Third, the 0.28.x line has had no release for almost two years, the master branch was bumped to 1.0.0 on 16 November 2026, and the 1.0.dev builds on PyPI are a redesigned package with no AsyncClient. Pick Requests for sync scripts and services; pick HTTPX for async code at moderate concurrency, HTTP/2 or in-process testing, and pin httpx<1 until 1.0 ships.
Last updated November 23, 2026. Covers Requests 2.34.2 (14 May 2026) and HTTPX 0.28.1 (6 December 2024) with httpcore 1.0.9, plus the HTTPX master 1.0.0 version bump of 16 November 2026 and the 1.0.dev6 pre-release; docs, changelogs and package metadata read on 23 November 2026, plus same-machine runs we did that day.
| Feature | Requests | HTTPX |
|---|---|---|
| Licence & Maintainer | Apache-2.0; maintained under the PSF GitHub org; ~54.7k stars | BSD-3-Clause; Encode OSS; ~15.8k stars |
| Latest Stable Release (Nov 2026) | 2.34.2 on 14 May 2026 (typing fix); 2.34.0 on 11 May added inline types and Python 3.15 support | 0.28.1 on 6 Dec 2024; master versioned 1.0.0 (unreleased) since 16 Nov 2026 |
| Python Support | Python 3.10+ (3.9 dropped in 2.33.0); 3.14t free-threaded supported since 2.34.0 | 0.28.1 requires Python 3.8+; the unreleased 1.0.0 changelog sets 3.10 as the minimum |
| Dependencies | urllib3, certifi, charset-normalizer, idna | httpcore, anyio, certifi, idna (h11 via httpcore); h2 with the http2 extra |
| Sync / Async API | Sync only | Sync Client and AsyncClient (asyncio and trio) |
| HTTP/2 | No | Yes, opt-in: httpx[http2] and http2=True; HTTP/1.1 stays the default |
| Default Timeouts | None: waits indefinitely unless you pass timeout= | 5 s of network inactivity on connect, read, write and pool; no total deadline |
| Redirects by Default | Followed automatically, up to 30 | Not followed unless follow_redirects=True; response.next_request exposes the next hop |
| Connection Pool Defaults | Via Session/HTTPAdapter: pool_connections 10, pool_maxsize 10, non-blocking | max_connections 100, max_keepalive_connections 20, keepalive_expiry 5 s |
| Built-in Retries | HTTPAdapter(max_retries=int or urllib3 Retry) with backoff and status lists; default 0 | HTTPTransport(retries=N) retries connection errors and connect timeouts only; default 0 |
| Testing Support | No built-in mock transport; use responses, requests-mock or a live test server | MockTransport, WSGITransport and ASGITransport built in |
| Type Hints | Inline types since 2.34.0 (May 2026) | Fully type annotated |
| Optional Extras | requests[socks], requests[use-chardet-on-py3] | httpx[http2], [socks], [brotli], [zstd], [cli] |
| Release Activity & Roadmap | Two minor releases in 2026 (2.33 in March, 2.34 in May); feature set stable | Last stable release December 2024; 1.0.0 changelog 'Unreleased'; 1.0.dev1-dev6 pre-releases (2 Jul 2025 to 31 Aug 2026) ship a redesigned client and server API |
| Our Run: sequential JSON GET with Session/Client | 1,029-1,082 req/s over 3 rounds of 3,000 requests | 1,134-1,385 req/s over 3 rounds of 3,000 requests |
| Our Run: top-level get() without Session/Client | 745 req/s (500 calls to requests.get()) | 60 req/s (500 calls to httpx.get()); httpx.Client() construction took ~18 ms |
| Our Run: 1,000 x 100 ms requests, 100 workers | 899 req/s with 100 threads and pool_maxsize=100 (ceiling 1,000) | 867-881 req/s with 100 threads at default limits; 48-62 req/s with max_keepalive_connections=100; AsyncClient 470 req/s at 100 concurrent |
| Our Run: CPU per 1,000 requests at high concurrency | 0.64-0.72 s CPU per 1,000 requests at 20, 50 and 100 threads | 0.68 s at 20 threads, 2.0 s at 50, 15.6-20.4 s at 100 with 100 keep-alive; AsyncClient 1.4-13.1 s depending on limits |
| Our Run: hung and slow-drip servers | Hung server: no timeout, still blocked at 20 s. With timeout=5: ReadTimeout at 5.01 s. Slow drip: completed after 20 s | Hung server: ReadTimeout at 5.02 s by default. Slow drip (1 byte/s): completed after 20 s, no total deadline |
| Our Run: HTTP/2 over TLS | HTTP/1.1 only | HTTP/2 with http2=True; 100 concurrent requests multiplexed on 1 connection |
Requests
Requests is the synchronous HTTP library most Python code already uses, built on urllib3. It gives you Sessions with connection pooling and cookie persistence, automatic redirects, streaming downloads, multipart uploads, proxies and .netrc support behind a small, stable API. It is maintained under the Python Software Foundation's GitHub organisation (psf/requests, ~54.7k stars) and licensed Apache-2.0. Version 2.34.0 (11 May 2026) replaced the typeshed stubs with inline types; 2.34.2 followed on 14 May 2026. It supports Python 3.10 and newer.
Pros
- Stable, familiar API that most Python developers, tutorials and SDKs already use; code from years ago still runs
- Fast enough for sequential work: a Session did 1,029-1,082 req/s against a local JSON endpoint in our run, within noise of httpx.Client
- Scales well with threads: 100 threads with pool_maxsize=100 delivered 899 req/s on a 100 ms endpoint using 0.67 s of CPU per 1,000 requests
- Inline type hints since 2.34.0, checked against mypy, pyright and ty according to the release notes
- Retries with backoff and status-based rules through urllib3's Retry on an HTTPAdapter
- Top-level requests.get() is cheap: 745 req/s without a Session in our run, so one-off scripts do not pay a setup cost
Cons
- No timeout by default: a request to our hung server was still waiting after 20 s until we killed the process
- Synchronous only; concurrency means threads or a separate async library
- No HTTP/2 support; our TLS server negotiated HTTP/1.1
- Follows redirects automatically, which can hide extra round trips
- No built-in mock or in-process app transport; tests rely on third-party packages such as responses or requests-mock
Best For
Synchronous scripts, CLIs, data pipelines, and services that call a handful of APIs, especially when the team already knows Requests and you want the least churn.
HTTPX
HTTPX is an HTTP client for Python from the Encode organisation with a mostly Requests-compatible API, both a sync Client and an AsyncClient, optional HTTP/2, strict default timeouts, full type annotations and transports that can call WSGI and ASGI apps directly. The transport layer is the separate httpcore package. HTTPX is BSD-3-Clause licensed with ~15.8k GitHub stars. The current stable release is 0.28.1 from 6 December 2024; the master branch was bumped to version 1.0.0 (unreleased) on 16 November 2026, while PyPI separately carries 1.0.dev pre-releases of a redesigned API.
Pros
- One API for sync and async code, so a library can offer both without two HTTP stacks
- Safer defaults: 5-second timeout on every network operation and no silent redirects; our hung request raised ReadTimeout at 5.02 s
- HTTP/2 with pip install httpx[http2]: 100 concurrent 100 ms requests went over one connection in 0.21 s in our run
- MockTransport, WSGITransport and ASGITransport let tests call your FastAPI or Flask app in-process without a server
- Fully type annotated and strict about inputs, such as binary-mode file uploads and content= for raw bodies
- Sequential throughput matched or beat Requests in our run: 1,134-1,385 req/s with a Client
Cons
- No stable release since 0.28.1 (December 2024); 1.0 is unreleased and the 1.0.dev builds on PyPI are a different API without AsyncClient
- Top-level httpx.get() builds a new client each call: 60 req/s in our run versus 745 for requests.get()
- Connection pool became CPU-bound at high concurrency in our runs: 48-62 req/s and 15-20 s CPU per 1,000 requests with 100 threads and 100 keep-alive connections
- Built-in retries only cover connection failures (HTTPTransport(retries=N)), not status codes
- Small but real migration cost from Requests: follow_redirects, content= vs data=, .stream() instead of stream=True, per-request cookies on a Client not supported
Best For
Async applications such as FastAPI services and asyncio workers at moderate concurrency, code that needs HTTP/2, and test suites that want to call ASGI or WSGI apps in-process.
Where the two libraries stand in late 2026
Requests is in steady maintenance with real releases. 2.33.0 (25 March 2026) dropped Python 3.9, moved to a PEP 517 build and fixed CVE-2026-25645 in the extract_zipped_paths utility; 2.34.0 (11 May) replaced typeshed's stubs with inline types and added Python 3.15 and free-threaded 3.14t support; 2.34.1 and 2.34.2 fixed typing regressions within days. HTTPX is in a stranger place. The latest stable release is 0.28.1 from 6 December 2024, almost two years old, and the dependency it uses for connections, httpcore, was last released as 1.0.9 in April 2025. On 16 November 2026 a commit titled 'Version 1.0' set the master branch's __version__ to 1.0.0, with a changelog entry marked Unreleased that raises the minimum Python to 3.10 and exposes FunctionAuth. Separately, PyPI has carried 1.0.dev1 to 1.0.dev6 pre-releases since July 2025 (the latest on 31 August 2026). We installed 1.0.dev6: it describes itself as an HTTP toolkit with client and server functionality, depends on truststore instead of certifi, and has no AsyncClient, no top-level get(), no Timeout or Limits classes. pip and uv skip pre-releases unless asked, so a plain install still gets 0.28.1, but the safe move today is to pin httpx<1 and read the 1.0 release notes when they appear.
Defaults that change what happens in production
The most important difference is not speed. Requests has no default timeout: we pointed requests.get() at an endpoint that accepts the request and never answers, and the process was still blocked after 20 seconds when timeout killed it; the Requests docs say a request without a timeout may hang for minutes or more. HTTPX raised ReadTimeout after 5.02 s with no configuration, because its default is 5 seconds of network inactivity on connect, read, write and pool acquisition. Neither library has a total deadline, though. We also served a response that dripped one byte per second for 20 seconds: Requests with timeout=5 and HTTPX with its default both waited the full 20 seconds and returned successfully, because each timeout measures the gap between bytes, not the whole request. If you need a wall-clock limit, wrap the call in asyncio.timeout() for AsyncClient or enforce it from a worker thread or a separate process. Redirects differ too: Requests followed our 302 to the JSON endpoint and recorded it in r.history, while HTTPX returned the 302 and exposed the next hop as response.next_request; pass follow_redirects=True when you want Requests' behaviour. HTTPX also encodes str bodies as UTF-8 where Requests uses Latin-1, and its JSON request bodies are compact since 0.28, which can break tests that compare raw bytes.
What we measured on the same machine
On 23 November 2026 we ran Requests 2.34.2 (urllib3 2.8.0) and HTTPX 0.28.1 (httpcore 1.0.9, h2 4.4.1) on Python 3.13.18 in a 2-vCPU sandbox, with a Uvicorn 0.54.0 server pinned to one core and the client pinned to the other. Sequentially, a requests.Session did 1,029-1,082 JSON requests per second over three rounds of 3,000, an httpx.Client 1,134-1,385; call that a tie. Without a Session or Client the picture flips: 500 calls to requests.get() ran at 745 req/s, httpx.get() at 60 req/s. The HTTPX top-level functions create and close a Client for every call, and constructing one took about 18 ms in our run, roughly 8 ms of it building the SSL context, even for a plain http:// URL. For concurrency we used an endpoint that sleeps 100 ms and sent 1,000 requests. At 20 workers both libraries hit the ceiling of 193 req/s with threads. At 100 threads, Requests reached 899 req/s on 0.67 s of CPU. HTTPX with its default limits (100 connections, 20 kept alive) reached 867-881 req/s, but when we set max_keepalive_connections to 100 to match the workers it collapsed to 48-62 req/s while burning 15.6-20.4 s of CPU, reproduced in three runs. These are single-machine runs on loopback, not a benchmark suite.
Async, HTTP/2 and when aiohttp is the better answer
HTTPX's main reason to exist is its AsyncClient, and it works: at 20 concurrent tasks it served 189 req/s against the 200 req/s ceiling, and with HTTP/2 enabled over TLS (Hypercorn 0.18.0 with a local CA) it pushed 100 concurrent 100 ms requests through a single connection in 0.21 s, where HTTP/1.1 needed 20 pooled connections and 0.29 s. Requests negotiated HTTP/1.1 on the same server because it has no HTTP/2 support. The cost showed up in CPU. For 1,000 requests at 20 concurrent tasks HTTPX used 1.38 s of CPU where aiohttp 3.14.5 used 0.19 s for the same throughput. At 100 tasks HTTPX reached 470 req/s and aiohttp 867; at 200 tasks HTTPX fell to 166 req/s with default limits and 75 req/s with limits raised to 200, while aiohttp did 925 req/s on 0.16 s of CPU. We did not trace the cause inside httpcore, so treat it as an observation: HTTPX is comfortable at tens of concurrent requests and needs measuring beyond that. If your workload is a crawler, a fan-out gateway or anything that keeps hundreds of requests in flight from one process, benchmark aiohttp alongside HTTPX before you commit. If it is a FastAPI service calling three internal APIs per request, HTTPX's ergonomics and testing story matter more than this ceiling.
Migrating from Requests, and when not to bother
Most Requests code ports to HTTPX by changing the import, but the documented differences bite in tests and edge cases. requests.Session becomes httpx.Client; set follow_redirects=True if your code assumed redirects; raw bodies move from data= to content= (data= with bytes or text is deprecated); response.url is a URL object, so wrap it in str() where you compare strings; streaming uses a with client.stream(...) block and iter_bytes() instead of stream=True and iter_content(); upload files must be opened in binary mode; and cookies must be set on the Client, not per request. Retries are the larger gap: Requests users usually mount an HTTPAdapter with urllib3's Retry for backoff on 502, 503 and 429, while HTTPX's HTTPTransport(retries=N) only retries failed connections, so status-based retries need your own loop or a library such as tenacity or stamina. The payoff is real if you need async or in-process tests: with ASGITransport, a pytest fixture can call your FastAPI app without starting a server, and MockTransport replaces requests-mock or responses. If none of that applies, the honest answer is to stay on Requests, add a timeout to every call (or a small Session subclass that injects one), and spend the migration time elsewhere. Pin whichever you choose; for HTTPX that means httpx>=0.28,<1 until 1.0 is released.
Verdict
Keep Requests for synchronous code. It was as fast as HTTPX for sequential calls in our run, it scaled better with threads, it is actively released (two minor versions in 2026, inline types in 2.34), and its one real trap, no default timeout, is fixed by always passing timeout= or setting it on a Session wrapper. Choose HTTPX when you need async in the same process as an asyncio framework, HTTP/2, or in-process testing of ASGI and WSGI apps through its transports; those are things Requests does not do at all. When you use HTTPX, always create one Client or AsyncClient and reuse it, keep the default pool limits unless you have measured otherwise, and pin httpx<1 because the next major version is unreleased and the pre-releases on PyPI change the API. If you need thousands of concurrent requests from one async process, test aiohttp as well: in our run it handled 200 concurrent 100 ms requests at 925 req/s on a fraction of the CPU HTTPX used. Do not switch a working Requests codebase to HTTPX only for speed; switch for async, HTTP/2 or better testability.