Skip to main content

A fast, modern HTTP client for Python

Project description

Fluxium

A fast, modern HTTP client for Python.

PyPI version Python CI License: MIT Coverage

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 — with zero blocking calls on the asyncio event loop.

import fluxium

r = fluxium.get("https://api.example.com")
print(r.json())

Verify installation:

python -c "import fluxium; print(fluxium.__version__)"

Installation

pip install fluxium

Optional extras:

pip install "fluxium[socks]"     # SOCKS proxy support
pip install "fluxium[uvloop]"    # 20-40% faster async
pip install "fluxium[cache]"     # Hishel RFC 7234 cache backend
pip install "fluxium[all]"       # Everything

Features

Feature Description
HTTP/2 Multiplexed connections, header compression (default enabled)
Connection Pooling Up to 200 connections, 100 keep-alive, with optional pre-warming
Automatic Retries Exponential backoff for 5xx and timeouts
Streaming & SSE iter_content(), iter_lines(), iter_sse()
Built-in Caching In-memory, disk-based, or RFC 7234 (hishel) with TTL
Middleware Hooks for logging, auth refresh, rate limiting
OAuth2 / Bearer Automatic token management and refresh
Async Full asyncio support via AsyncSession
uvloop Auto-used when installed for 20-40% async throughput

Quick Start

Basic Requests

import fluxium

r = fluxium.get("https://api.example.com", timeout=10)
print(r.status_code, r.json())

r = fluxium.post("https://api.example.com/items", json={"name": "widget"})

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

Pre-warming Connections

with fluxium.Session() as s:
    s.prewarm("https://api.example.com")  # Opens connection now
    r = s.get("https://api.example.com")  # Uses pooled connection

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)

    r = s.get("https://api.example.com/events", stream=True)
    for event in fluxium.iter_sse(r):
        print(event.event, event.json())

Timeouts

from fluxium import Timeout

# All components same timeout
fluxium.get("https://api.example.com", timeout=30.0)

# Structured timeout
fluxium.get("https://api.example.com", timeout=Timeout(connect=5.0, read=30.0))

# Or use tuple shorthand (connect, read)
fluxium.get("https://api.example.com", timeout=(5.0, 30.0))

Rate Limiting

from fluxium import Session, RateLimitMiddleware

s = Session()
s.add_middleware(RateLimitMiddleware(calls=100, period=60))  # 100 req/min

Per-Request Hooks

s = Session()
s.add_hook("response", lambda response, request: log(response))
s.add_hook("error", lambda error, request: notify(error))

Performance

Cached workloads: fluxium is 4.3x faster than httpx. On unique requests, performance is comparable.

Scenario vs httpx
Repeated GET with MemoryCache ~4.3x faster
Session GET (pooled) ~1.6x slower (per-request overhead)
One-shot GET ~1.03x (negligible)
Async concurrent ~1.5x slower
Body encoding / CookieJar ~1.0x (identical)

Key takeaway: fluxium wins on repeated requests (caching) and is competitive on unique requests. Install uvloop for 20-40% async throughput improvement.

Documentation

  • Getting Started — install, first request, compatibility
  • Guides — step-by-step tutorials for every feature
  • API Reference — complete class and method signatures
  • Advanced — custom middleware, performance, SSE deep-dive
  • Changelog — version history and migration guide

Contributing

See CONTRIBUTING.md.

License

MIT — © 2026 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

fluxium-3.0.1.tar.gz (41.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fluxium-3.0.1-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

Details for the file fluxium-3.0.1.tar.gz.

File metadata

  • Download URL: fluxium-3.0.1.tar.gz
  • Upload date:
  • Size: 41.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fluxium-3.0.1.tar.gz
Algorithm Hash digest
SHA256 a2c5f95340d1034ec856dc2c394ccff4138cdede5c45c4f7220f355570803f13
MD5 8cf29f5498f9f6bc7e6c71009772ddb2
BLAKE2b-256 d5c5eb84e954e59ad71ffcbe77d51ae5491a265dcb8398b200722aee69f31fb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for fluxium-3.0.1.tar.gz:

Publisher: pypi.yml on siddhant-bayas/fluxium

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fluxium-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: fluxium-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 26.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fluxium-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2fa90e40dd713a19145289378168f8076884ceefa2705efb7e30b12489ddc6e2
MD5 03400a892da92007f79c3e3d5ddcf9f6
BLAKE2b-256 c807e0afa48830ec34f1bbe58d0c2393b8e2d30ef100a164c8e7cec5570a9387

See more details on using hashes here.

Provenance

The following attestation bundles were made for fluxium-3.0.1-py3-none-any.whl:

Publisher: pypi.yml on siddhant-bayas/fluxium

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page