httpx vs requests: Do You Need to Switch
requests is fine for most scripts. httpx earns its place with async and HTTP/2, but it is in low-level maintenance and httpx2 continues it
You don’t need to switch from requests to httpx unless you’re writing async code or need HTTP/2. For everything else, requests remains a well-maintained default (version 2.34.2, May 2026). httpx doesn’t obsolete it; it fills two gaps requests was never built to cover. The twist in late 2026 is that the original httpx has stepped back to light maintenance and a continuation has appeared, which affects which one you should pick for new code.
httpx and httpx2: the maintenance picture
httpx 0.29.0 was released on 26 November 2026, the first release since 0.28.1 on 6 December 2024. It is a small one: it raises the minimum to Python 3.10 and makes FunctionAuth part of the public API. At the same time, the project’s contributing guide says HTTPX is entering a period of low-level maintenance: only the most serious bug reports may be considered, no further feature development is planned, and the maintainers are focusing on hip, which they call the next version of HTTPX and say is designed to address fundamental architectural and security issues. We have not tested hip, so we make no recommendation about it yet.
Separately, in 2026 Pydantic began publishing a continuation under the name httpx2 (first upload 11 May 2026, latest 2.16.2 on 16 November 2026, Python 3.11 or later). Its README says Pydantic is “picking up stewardship” because httpx itself has seen limited activity, and promises timely security updates. You import it as httpx2. It is also already on many machines: the OpenAI Python library 3.x lists httpx2 as a dependency.
In the checks for this guide, httpx 0.28.1 and httpx2 2.16.0 behaved the same on the points compared below, and the three default behaviours and the HTTP/2 requirement were re-run on httpx 0.29.0 on 28 November 2026 with the same results. If you are starting a new project and want httpx’s API from a package that is being actively developed, httpx2 is the choice we would make; existing code on httpx keeps working, but decide where it is heading.
What httpx (and httpx2) actually add
Async support. requests is synchronous only: it has no async client, and it blocks while waiting on a response. httpx ships both a sync and an async client (AsyncClient), letting you issue many requests concurrently with asyncio instead of one at a time. This is the actual reason to reach for it if you’re writing a FastAPI backend that calls external APIs or a concurrent scraper.
HTTP/2 support. requests only speaks HTTP/1.1. httpx supports HTTP/2, opt-in with http2=True, and it needs the h2 package: without it, httpx.Client(http2=True) raises an ImportError, so install the extra (pip install "httpx[http2]"). It can help with many small requests to the same host on servers that support it.
What’s the same, and what isn’t
httpx was designed with a requests-like API (httpx.get(), .post(), .json(), .status_code, httpx.Client() for sessions), so simple code often needs little more than an import change. But three defaults differ, and each can silently change behaviour. This script starts a small local server and shows all three; it runs as written:
import threading
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
import httpx2
import requests
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == "/redirect":
self.send_response(302)
self.send_header("Location", "/final")
self.end_headers()
return
body = b'{"ok": true}'
self.send_response(200)
self.send_header("Content-Type", "application/json")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
def log_message(self, *args):
pass
server = ThreadingHTTPServer(("127.0.0.1", 0), Handler)
threading.Thread(target=server.serve_forever, daemon=True).start()
base = f"http://127.0.0.1:{server.server_port}"
print("requests follows redirects:", requests.get(base + "/redirect").status_code) # 200
print("httpx2 does not by default:", httpx2.get(base + "/redirect").status_code) # 302
print("httpx2 with follow_redirects=True:", httpx2.get(base + "/redirect", follow_redirects=True).status_code) # 200
print("httpx2 default read timeout:", httpx2.Client().timeout.read, "seconds") # 5.0- Redirects. requests follows them by default; httpx and httpx2 return the 302 unless you pass
follow_redirects=True. - Timeouts. httpx applies a 5-second timeout by default. requests has no default timeout, so a stalled server can hang a requests call indefinitely unless you pass
timeout=. - HTTP/2 needs the extra installed, as above.
Third-party requests plugins and adapters also don’t carry over automatically.
Performance: not the deciding factor for sync code
For plain synchronous requests, httpx isn’t meaningfully different from requests. The case for it is concurrency. Against a local server where each request took 0.2 seconds, five sequential requests.get calls took about four times as long as the same five run with asyncio.gather on an async httpx (or httpx2) client, on one laptop with Python 3.14. The ideal would be five times; connection setup and the server explain the gap. Don’t switch expecting a sync speed boost, and treat the ratio as an illustration rather than a benchmark of your own traffic.
The actual decision
- Synchronous scripts with no async involved → requests is fine, and there’s no strong reason to migrate working code.
- Async code, or many concurrent requests → httpx2 for new work (actively developed), or httpx if you already depend on it and accept light maintenance with no new features.
- Need HTTP/2 → httpx or httpx2 with the
h2extra; requests can’t do it. - Starting a new project with no strong opinion → httpx2: it covers what requests does plus the async path if you need it later. Remember the redirect and timeout defaults when you port code.
Frequently Asked Questions
Is httpx a replacement for requests?
It’s designed to be similar for the common cases, but not a drop-in. Three defaults differ: httpx does not follow redirects unless you pass follow_redirects=True, it applies a 5-second timeout by default where requests has none, and HTTP/2 needs the h2 extra installed. Third-party requests plugins don’t carry over.
Is httpx still maintained?
Only lightly. httpx 0.29.0 came out on 26 November 2026, its first release since December 2024, but the project’s contributing guide says it is entering low-level maintenance with no further feature development, and that work has moved to a successor called hip. Separately, Pydantic maintains a continuation called httpx2 (version 2.16.2 on 16 November 2026, Python 3.11 or later). The OpenAI Python library 3.x depends on httpx2.
Why would you use httpx over requests?
Two reasons: async support (requests is sync-only) and HTTP/2 support. If your code is async or you need HTTP/2, httpx or httpx2 is the clear choice. For plain synchronous scripts, it’s a smaller win.
Is requests no longer maintained?
It is maintained: requests 2.34.2 was released on 14 May 2026 and needs Python 3.10 or later. It is simply not being extended with async or HTTP/2 support, which is the gap httpx and httpx2 fill.
Is httpx faster than requests?
Not for a single synchronous request. Its advantage is async concurrency: in a local test with a slow endpoint, five sequential requests calls took about four times as long as the same five run concurrently with an async httpx client.