Reference
Complete API reference, comparisons, and practical examples
Comparison with Other Libraries
AtomHTTP delivers the broadest feature set among Python HTTP clients: progress callbacks, full interceptor chain, concurrent helpers, Blob/ArrayBuffer support, and fine‑grained limits — all with a clean, modern API.
| Feature | AtomHTTP | requests | aiohttp | httpx |
|---|---|---|---|---|
| Async/Await | ||||
| Upload Progress | ||||
| Download Progress | ||||
| Interceptors | Full | Limited | ||
| validateStatus | Built-in | |||
| Blob/ArrayBuffer | response_type | content | read() | content |
| Base URL | ||||
| Concurrent Helpers | .all()/.spread() | ThreadPool | manual | manual |
| Type Hints | Full | Partial |
AtomHTTP combines the best features from existing libraries while adding unique capabilities like progress tracking, a full interceptor system, and comprehensive type hints. It is the only Python HTTP client that provides upload/download progress callbacks out of the box.
Feature Comparison
Compare AtomHTTP with other popular HTTP clients side by side. Each tab shows the same feature implemented in different libraries.
Upload Progress Tracking
SupportedUpload and download progress tracking with real-time callbacks
import asyncio
from atomhttp import AtomHTTP
def on_upload(loaded, total):
percent = (loaded / total) * 100
print(f"Upload: {percent:.1f}% ({loaded}/{total} bytes)")
async def upload_file():
client = AtomHTTP({'baseURL': 'https://httpbin.org'})
with open('test.txt', 'rb') as f:
resp = await client.post(
'/post',
data=f,
on_upload_progress=on_upload
)
print("AtomHTTP Status:", resp.status)
await client.close()
asyncio.run(upload_file())Concurrent Requests
SupportedExecute multiple requests in parallel
import asyncio
from atomhttp import AtomHTTP
async def fetch_posts():
client = AtomHTTP({'baseURL': 'https://jsonplaceholder.typicode.com'})
tasks = [
client.get('/posts/1'),
client.get('/posts/2'),
client.get('/posts/3')
]
responses = await AtomHTTP.all(tasks)
for resp in responses:
print(f"AtomHTTP: Post {resp.data['id']} → {resp.data['title'][:30]}...")
await client.close()
asyncio.run(fetch_posts())Status Validation
SupportedAutomatic HTTP status code validation
import asyncio
from atomhttp import AtomHTTP
from atomhttp.errors import AtomHTTPRequestError
async def check_status():
client = AtomHTTP({
'baseURL': 'https://httpbin.org',
'validateStatus': lambda status: status == 200
})
try:
resp1 = await client.get('/status/200')
print(f"AtomHTTP: Status {resp1.status} OK")
resp2 = await client.get('/status/404')
print(f"This won't print")
except AtomHTTPRequestError as e:
print(f"AtomHTTP: Request failed with status {e.response.status}")
await client.close()
asyncio.run(check_status())Binary Data (Blob)
SupportedBinary data handling (images, PDFs, etc.)
import asyncio
from atomhttp import AtomHTTP
async def download_image():
client = AtomHTTP()
response = await client.get(
'https://httpbin.org/image/png',
response_type='blob'
)
with open('atomhttp_image.png', 'wb') as f:
f.write(response.data)
print(f"AtomHTTP: Saved {len(response.data)} bytes")
await client.close()
asyncio.run(download_image())Request/Response Interceptors
SupportedModify requests/responses globally
import asyncio
from atomhttp import AtomHTTP
async def main():
client = AtomHTTP()
async def log_interceptor(config):
print(f"Request: {config.method} {config.url}")
return config
client.interceptors.use(log_interceptor)
response = await client.get('https://httpbin.org/get')
await client.close()
asyncio.run(main())Custom Headers
SupportedCustom headers support
import asyncio
from atomhttp import AtomHTTP
async def custom_headers():
client = AtomHTTP()
response = await client.get(
'https://httpbin.org/headers',
headers={
'Authorization': 'Bearer my-token-123',
'X-Custom-Header': 'my-value'
}
)
headers = response.data.get('headers', {})
print(f"AtomHTTP: Authorization = {headers.get('Authorization')}")
await client.close()
asyncio.run(custom_headers())Why AtomHTTP Stands Out
AtomHTTP is the only library that combines all these features in one package:
Upload Progress
Real-time upload progress callbacks
Download Progress
Track download progress with ease
Interceptors
Request/response middleware
Status Validation
Built-in validateStatus
Concurrent Helpers
.all() and .spread() methods
Blob/ArrayBuffer
Simple binary data handling
AtomHTTP is the only Python HTTP client that can handle file uploads with progress tracking, concurrent requests with .all()/.spread(), automatic status validation, binary data with response_type="blob", and request/response interceptors — all in a single library.
API Methods Reference
Complete reference of all available methods on the AtomHTTP client and helper functions.
| Method | Description | Example |
|---|---|---|
| client.get(url, params) | HTTP GET request | await client.get("/users") |
| client.post(url, data) | HTTP POST request | await client.post("/users", data={...}) |
| AtomHTTP.all(tasks) | Execute concurrent requests | responses = await AtomHTTP.all(tasks) |
| client.close() | Clean up resources | await client.close() |
Error Codes Reference
AtomHTTP provides standardized error codes for programmatic error handling.
| Error Code | Description | Exception Type |
|---|---|---|
| ERR_BAD_REQUEST | Bad request (4xx) or malformed request | AtomHTTPRequestError |
| ERR_NETWORK | Network connectivity issues | AtomHTTPNetworkError |
| ECONNABORTED | Request exceeded timeout limit | AtomHTTPTimeoutError |
Response Types
AtomHTTP supports multiple response types for different use cases.
jsonParse response as JSON (dict/list). Default option for API calls.
textReturn response as plain text string. Good for HTML, CSV, plain text.
blobReturn response as bytes. Perfect for images, PDFs, ZIP files.
streamReturn async iterator. Best for very large files and video streaming.