Comparing
The next generation HTTP client
Python HTTP for Humans
| Metric | httpx | requests |
|---|---|---|
| Ecosystem | Python | Python |
| Difficulty | Intermediate | Beginner ✓ |
| Weekly downloads | 119.1M | 324.9M↑ |
| Latest version | v0.28.1 | v2.33.1 |
| Recipes | 2 | 3↑ |
httpx only
Shared
requests only
Use httpx when building FastAPI or asyncio applications that call external APIs. Also reach for it when you need HTTP/2 support, a requests-compatible API with async support, or a single library that works in both sync and async contexts.
Use requests for any synchronous HTTP work: calling REST APIs, scraping web pages, downloading files, or integrating with webhooks. It's the right default for scripts, CLI tools, and Django/Flask backends that don't need async.
For simple synchronous scripts where you already use requests, there's little reason to switch — requests has a larger ecosystem of auth libraries and middleware. For high-volume async scraping at scale, aiohttp's lower-level control may be more efficient.
Avoid requests when you're writing async code — it will block your event loop. Switch to httpx (drop-in async API) or aiohttp for FastAPI backends, async scrapers, or anything running inside asyncio.
httpx
requests