HTTPX

Modern, fully-featured HTTP client for Python with both sync and async APIs. Drop-in replacement for requests with async/await support, HTTP/2, connection pooling, streaming responses, timeout configuration, and HTTPX test client for ASGI apps (FastAPI, Starlette). The modern Python HTTP client for applications needing both sync and async HTTP support.

Evaluated Mar 06, 2026 (0d ago) v0.27.x
Homepage ↗ Repo ↗ Developer Tools http async python requests-alternative httpx httpx-client http2
⚙ Agent Friendliness
71
/ 100
Can an agent use this?
🔒 Security
92
/ 100
Is it safe for agents?
⚡ Reliability
88
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
92
Error Messages
88
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
95
Auth Strength
92
Scope Granularity
90
Dep. Hygiene
90
Secret Handling
90

BSD 3-Clause licensed. Enforces SSL certificate verification by default (verify=True). Supports client certificates, custom CA bundles. Auth helpers for Bearer, Basic, Digest auth.

⚡ Reliability

Uptime/SLA
100
Version Stability
85
Breaking Changes
80
Error Recovery
88
AF Security Reliability

Best When

You're building async Python services (FastAPI, async agent workers) and need a modern HTTP client with the same ergonomics as requests but with async/await support.

Avoid When

You're in a fully synchronous codebase with no async requirements — requests is simpler and more widely documented. HTTPX shines in async contexts.

Use Cases

  • Make async HTTP requests in FastAPI agent services using the same API as the synchronous client
  • Build agent HTTP clients with connection pooling and HTTP/2 support for high-performance API consumers
  • Test FastAPI/Starlette agent APIs with HTTPX's TestClient without running an actual server
  • Stream large responses in agent download pipelines without loading full responses into memory
  • Replace requests in existing agent codebases with a drop-in async-capable alternative

Not For

  • Simple one-off scripts where requests is already installed and async isn't needed
  • Browser automation — use Playwright or Selenium for browser-level HTTP interception
  • WebSocket connections — use websockets or aiohttp for WebSocket support

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

Local library — no authentication required. BSD 3-Clause licensed. Auth is configured per client instance.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

BSD 3-Clause licensed. Zero cost.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Documented

Known Gotchas

  • Must use async with httpx.AsyncClient() as client: context manager for proper connection cleanup — not doing so leaks connections
  • HTTPX has strict timeout defaults (5 seconds) unlike requests (no timeout) — set httpx.Timeout(30.0) for slow APIs or use None for no timeout
  • Response content is NOT automatically decoded for streaming — use async for chunk in response.aiter_bytes(): for streaming; response.content for full response
  • TestClient for ASGI apps: from httpx import Client; from starlette.testclient import TestClient — HTTPX's AsyncClient with ASGITransport for async test patterns
  • HTTP/2 requires h2 package: pip install httpx[http2] — not included by default; worth enabling for high-concurrency API consumers
  • follow_redirects defaults to False unlike requests (True) — set follow_redirects=True explicitly if your API uses redirects

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for HTTPX.

$99

Scores are editorial opinions as of 2026-03-06.

5208
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered