pkgdocs/compare/httpx vs requests

Comparing

Python

httpx

The next generation HTTP client

119.1M/ wk
v0.28.1
vs
Python

requests

Python HTTP for Humans

324.9M/ wk
v2.33.1
Metrichttpxrequests
EcosystemPythonPython
DifficultyIntermediateBeginner ✓
Weekly downloads119.1M324.9M↑
Latest versionv0.28.1v2.33.1
Recipes23↑

Tags

httpx only

asyncasynciohttp2trio

Shared

httpapi-clientwww/httppython

requests only

requestsrestlibrariesclientcookiesforhumans

When to use each

httpx

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.

requests

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.

When to skip each

httpx

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.

requests

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.

Sample recipes

httpx

  • Introduction
  • Installation

requests

  • Install requests
  • Requests
  • Cloning the repository