httpr¶
Blazing fast HTTP client for Python, built in Rust.
httpr is a drop-in replacement for httpx and requests with significantly better performance. Built on top of Rust's reqwest library with zero Python dependencies.
import httpr
# Simple as requests
response = httpr.get("https://httpbin.org/get")
print(response.json())
# Or use a client for connection pooling
with httpr.Client() as client:
response = client.get("https://httpbin.org/get")
print(response.status_code) # 200
-
Fast
Built on Rust's
reqwest- one of the fastest HTTP clients available. See the benchmarks. -
Sync & Async
Both synchronous
ClientandAsyncClientwith identical APIs. First-class async support. -
Lightweight
Zero Python dependencies. Everything is implemented in Rust. Just install and use.
-
Secure
Full SSL/TLS support including mTLS (mutual TLS) for enterprise authentication.
-
HTTP/2
Native HTTP/2 support for better performance with multiplexed connections.
-
Cookie Store
Automatic cookie handling with persistent cookie store across requests.
Installation¶
Quick Example¶
import httpr
# Create a client with default settings
client = httpr.Client(
timeout=30,
follow_redirects=True,
)
# Make requests
response = client.get("https://httpbin.org/get", params={"key": "value"})
print(response.status_code) # 200
print(response.json()) # {"args": {"key": "value"}, ...}
# POST with JSON
response = client.post(
"https://httpbin.org/post",
json={"name": "httpr", "fast": True}
)
# Response properties
print(response.text) # Response body as text
print(response.content) # Response body as bytes
print(response.headers) # Response headers (case-insensitive)
print(response.cookies) # Response cookies
Features¶
-
Streaming
Stream large responses efficiently without buffering entire response in memory. Iterate bytes, text, or lines.
Not Yet Implemented¶
- Fine-grained error handling: Detailed error types are in development
LLM-Friendly Documentation¶
This documentation is available in LLM-optimized formats:
- llms.txt - Documentation index for LLMs
- llms-full.txt - Complete documentation in a single file
-
Learn
New to httpr? Start with the Quickstart guide.
-
Tutorial
Step-by-step guides covering all features.
-
Advanced
SSL/TLS, proxies, cookies, and more.
-
API Reference
Complete API documentation.