A fast, modern HTTP client for Python
Project description
Fluxium
A fast, modern HTTP client for Python.
Fluxium provides a clean, requests-like API with HTTP/2 multiplexing, automatic retries, connection pooling, streaming, SSE, middleware hooks, built-in caching, and full async support — all with zero blocking calls on the asyncio event loop.
import fluxium
r = fluxium.get("https://api.example.com")
print(r.json())
Installation
pip install fluxium
With SOCKS proxy support:
pip install "fluxium[socks]"
Features
| Feature | Description |
|---|---|
| HTTP/2 & HTTP/3 | Multiplexed connections, header compression |
| Connection Pooling | Up to 200 connections, 100 keep-alive |
| Automatic Retries | Exponential backoff for 5xx and timeouts |
| Streaming & SSE | iter_content(), iter_lines(), iter_sse() |
| Built-in Caching | In-memory or disk-based with TTL |
| Middleware | Hooks for logging, auth refresh, rate limiting |
| OAuth2 / Bearer | Automatic token management and refresh |
| Async | Full asyncio support via AsyncSession |
| Zero Blocking | No blocking calls on the event loop |
Quick Start
Basic Requests
import fluxium
# GET
r = fluxium.get("https://api.example.com", timeout=10)
print(r.status_code, r.json())
# POST JSON
r = fluxium.post("https://api.example.com/items", json={"name": "widget"})
# Query params
r = fluxium.get("https://api.example.com/search", params={"q": "python"})
# Custom headers
r = fluxium.get("https://api.example.com", headers={"X-Custom": "value"})
Sessions (Connection Pooling)
with fluxium.Session() as s:
r1 = s.get("https://api.example.com/users")
r2 = s.post("https://api.example.com/items", json={"name": "x"})
# Cookies from r1 are automatically sent with r2
Async
import asyncio, fluxium
async def main():
async with fluxium.AsyncSession() as s:
tasks = [s.get(f"https://api.example.com/item/{i}") for i in range(10)]
results = await asyncio.gather(*tasks)
asyncio.run(main())
Retries & Caching
from fluxium import Session, MemoryCache
with Session(max_retries=3, cache=MemoryCache()) as s:
r = s.get("https://api.example.com") # retried on failure, cached on success
Streaming & SSE
with fluxium.Session() as s:
r = s.get("https://api.example.com/stream", stream=True)
for line in r.iter_lines():
print(line)
# Server-Sent Events
r = s.get("https://api.example.com/events", stream=True)
for event in fluxium.iter_sse(r):
print(event.event, event.json())
OAuth2
from fluxium import OAuth2Auth
auth = OAuth2Auth(
token_url="https://auth.example.com/token",
client_id="my-client",
client_secret="my-secret",
)
r = fluxium.get("https://api.example.com", auth=auth)
Documentation
See the docs/ directory for full API reference and guides.
Benchmarks
On a local HTTP server (200 requests, connection pooling):
| Library | Per-request |
|---|---|
| fluxium | 0.59 ms |
| requests | 0.65 ms |
| httpx | 0.54 ms |
License
MIT — © 2025 Siddhant Bayas
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fluxium-1.0.0.tar.gz.
File metadata
- Download URL: fluxium-1.0.0.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35f54598c175870dd6fc0ba9ecbc37cfd7b16f7150adf858fe2695bf6fbda391
|
|
| MD5 |
26308aee8f107364d3496aa30c764737
|
|
| BLAKE2b-256 |
8a56301e6c5ac15ce03d82054ae1768adc669b1229056a9768676038fbb4afd1
|
File details
Details for the file fluxium-1.0.0-py3-none-any.whl.
File metadata
- Download URL: fluxium-1.0.0-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc81e385c3796dc4eb7ae4c60d216b89504b60bae3b354f218d1ec380ef9dc2f
|
|
| MD5 |
bb7ee1d5e6335ec0599314a77aa01f53
|
|
| BLAKE2b-256 |
d5b8c0794acbb81f4ef3e39398edeffca9463caf23196122569db4f7d569f747
|