Skip to main content

FogHTTP logo

FogHTTP

Rust-powered HTTP client for Python with sync and asyncio APIs.

FogHTTP is an early MVP HTTP client. The public API is Python-first, while the transport core is implemented in Rust on top of hyper.

FogHTTP is positioned as an observable, high-concurrency Rust-powered transport for Python services. It is built for controlled service-to-service HTTP workloads where explicit lifecycle, predictable resource usage, cancellation, redirect history, and request backpressure visibility matter more than browser-like feature parity.

Until version 0.5.0, backward compatibility is not guaranteed. I will still try to keep public interfaces stable and avoid unnecessary breaking changes.

Why FogHTTP

  • Rust hyper transport with a Python-first API
  • sync and asyncio clients with the same request model
  • explicit close()/aclose() lifecycle for Rust transport resources
  • graceful sync close() for in-flight requests and cancellable async requests
  • bounded global/per-origin request backpressure, FIFO pending-acquire limits, explicit HTTP/1.1 connection caps, and per-origin pressure diagnostics
  • typed telemetry event hooks with redacted request/response lifecycle events
  • versioned telemetry snapshots that separate alert-oriented stats from diagnostic dump APIs
  • opt-in async lifecycle debug snapshots for staging and tests
  • lazy process-wide shared Tokio runtime by default, opt-in dedicated runtime tuning, and fail-closed client ownership across fork()
  • focused HTTP surface for JSON, form, streaming upload, and multipart API workloads in internal services, workers, and benchmarks

Install

pip install foghttp

Runtime requirements:

  • Python >=3.11
  • orjson>=3.11,<4

Published CPython wheels use the stable cp311-abi3 ABI: each supported OS/architecture pair has one wheel for Python 3.11 and newer. The release pipeline currently installs and exercises those wheels on GIL-enabled CPython 3.11 through 3.14. See Packaging and Python compatibility for the complete wheel matrix and validation policy.

Quick Start

import foghttp


with foghttp.Client(
    base_url="https://api.example.com",
    headers={"accept": "application/json"},
    params={"api-version": "1"},
) as client:
    response = client.get(
        "users",
        params={"limit": 10},
    )

    response.raise_for_status()
    print(response.status_code)
    print(response.json())

Async clients use the same request API:

import foghttp


async with foghttp.AsyncClient() as client:
    response = await client.post(
        "https://api.example.com/users",
        json={"name": "Ada Lovelace"},
    )
    response.raise_for_status()

What Works Today

  • sync Client and async AsyncClient
  • GET, HEAD, POST, PUT, PATCH, DELETE, and RFC 10008 QUERY
  • base_url for reusable API clients and relative request paths
  • default client headers and query params for reusable API clients
  • query params with repeated keys, JSON, form-urlencoded data, buffered bytes/text bodies, binary file-like request bodies, and streaming bytes-like upload providers
  • multipart files= uploads with bytes-like parts, binary file-like objects, direct byte streams, and replayable byte-stream factories
  • buffered Response with status flags, charset-aware text, json(), raise_for_status(), and request metadata
  • transparent gzip, deflate, and br decoding for buffered responses
  • sync and async bytes/text/line response streaming with explicit context-managed lifecycle
  • prepared Request objects with build_request() and send()
  • case-insensitive Headers with repeated values
  • safe policy for transport-managed request headers
  • redacted repr/error surfaces for sensitive headers, URL credentials, token-like URL params, and buffered body bytes
  • normalized URL model with origin comparison and relative joins
  • GET/HEAD/POST/QUERY redirects with final URL, history, and conservative replay policy
  • HTTP proxy routing and HTTPS proxy CONNECT tunnelling through explicit proxy= or trust_env=True when the proxy endpoint uses http://
  • HTTPS with default WebPKI roots, explicit custom CA certificates, and custom-only CA trust
  • graceful sync close() that waits for in-flight sync requests
  • async request cancellation that aborts the in-flight Rust request
  • bounded global and per-origin request slots with a bounded FIFO pending queue
  • opt-in global/per-origin HTTP/1.1 connection caps with separate connection acquire pressure and idle lifecycle diagnostics
  • opt-in typed telemetry event hooks for request, redirect, response headers, response body, and request completion lifecycle
  • versioned telemetry snapshot metadata for stats(), dump_transport_state(), and dump_pool_diagnostics()
  • opt-in async lifecycle debug mode for active request snapshots, strict leak checks, and unclosed-client diagnostics
  • default per-response and aggregate buffered response body limits for memory safety
  • shared Tokio runtime by default, with opt-in dedicated runtime worker tuning
  • grouped HTTP status constants and reusable HTTP method constants

Documentation

Current Limitations

FogHTTP is currently focused on controlled HTTP workloads. Buffered responses are the broadest supported response path; sync and async response streaming are available as bytes/text/line context-managed APIs. Streaming content= uploads and multipart files= uploads are available with explicit replayability and cleanup rules. HTTP proxy routing and HTTPS proxy CONNECT tunnelling are available through proxy= and trust_env=True when the proxy endpoint itself uses http://. Cookies, auth helpers, HTTP/2, automatic Accept-Encoding negotiation, streaming decompression, and per-request connect timeout reconfiguration are planned for later versions. Physical connection caps currently apply to the HTTP/1.1 connector path; HTTP/2 will require separate stream-level limits. Response body read timeout is available for buffered and streaming response bodies; request body write timeout is available for buffered and streaming request bodies. Socket lifecycle telemetry is available for the current HTTP/1 path. Disabling TLS verification is intentionally not supported.

Development

Development requires a Rust toolchain with cargo available in PATH.

uv run --extra dev --with "maturin>=1.7,<2" maturin develop
uv run --extra dev coverage run -m pytest
uv run --extra dev coverage report -m
uv run --extra dev pre-commit run --all-files --show-diff-on-failure

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

foghttp-0.3.6.tar.gz (1.5 MB view details)

Uploaded Source

Built Distributions

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

foghttp-0.3.6-cp311-abi3-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.11+Windows x86-64

foghttp-0.3.6-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

foghttp-0.3.6-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.4 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

foghttp-0.3.6-cp311-abi3-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

foghttp-0.3.6-cp311-abi3-macosx_10_12_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file foghttp-0.3.6.tar.gz.

File metadata

  • Download URL: foghttp-0.3.6.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for foghttp-0.3.6.tar.gz
Algorithm Hash digest
SHA256 84dab3954d8aa818c88d8ac04d0b93488f72f18231ca81e7de4bc6d38988da95
MD5 8bb58d8b96073da1b9bdc3d3908c478c
BLAKE2b-256 7040264030de13f48a3f82f71bc3d3dab4c6182f6ad7ee4a03bbadb81eef169e

See more details on using hashes here.

Provenance

The following attestation bundles were made for foghttp-0.3.6.tar.gz:

Publisher: release.yml on AmberFog/foghttp

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

File details

Details for the file foghttp-0.3.6-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: foghttp-0.3.6-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for foghttp-0.3.6-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 52127b670f6a9ca2348a89ae70dac04a62260c7783ef1489c4ae28cfc3f657c3
MD5 4a865bfd3cf3aaef41cbe87cf678a2a3
BLAKE2b-256 030eef782d3d5114b8c3b747598441e44b224a1197a30e838e9ba4e9830172b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for foghttp-0.3.6-cp311-abi3-win_amd64.whl:

Publisher: release.yml on AmberFog/foghttp

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

File details

Details for the file foghttp-0.3.6-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for foghttp-0.3.6-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8413ed4155f8b6736019c8b4fa1749168f7c3aa33ea53c21f49dc5d7cd430532
MD5 0b1fb69b31e3a1c729cd3f31200fbb24
BLAKE2b-256 da1e2cf1623b90e89544616dc45ab53fc9c1c5bfe63c6e5d0028577e6d57afb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for foghttp-0.3.6-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on AmberFog/foghttp

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

File details

Details for the file foghttp-0.3.6-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for foghttp-0.3.6-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3b91f7244fe1334f4bcfa428e1f31ac8f2ea797d987e32c8d1700717869ddabe
MD5 7c89071054064e197d9112d211d2a7fb
BLAKE2b-256 2626fa5e9cd931133b8a4bfdd5215f21e0d5d4c6eb5ec3910bab08c401ff8489

See more details on using hashes here.

Provenance

The following attestation bundles were made for foghttp-0.3.6-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on AmberFog/foghttp

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

File details

Details for the file foghttp-0.3.6-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for foghttp-0.3.6-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 482b5fe74906a9e025a0825afa15daefe20c68dbe7f56c456b2ea99f95775767
MD5 679bdc484facdde00828e156a9897901
BLAKE2b-256 fd475a09f233e8fa89b6d4d495445731ae353f37a626602afdd167f67a84a005

See more details on using hashes here.

Provenance

The following attestation bundles were made for foghttp-0.3.6-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on AmberFog/foghttp

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

File details

Details for the file foghttp-0.3.6-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for foghttp-0.3.6-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 71a4ff3c0eb8fe0cccc3224faad87e6c81e731417d506424b6f249add4231d94
MD5 1448b2fa19dfc59460158d3b58d0900c
BLAKE2b-256 0114a2a938d898c725f21f32b2d66061802b29b50441cf2bcaa9595c235db394

See more details on using hashes here.

Provenance

The following attestation bundles were made for foghttp-0.3.6-cp311-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on AmberFog/foghttp

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

Release history Release notifications | RSS feed

0.4.0

6 files

0.3.9

6 files

0.3.8

6 files

0.3.7

6 files

This release

0.3.6 This release

6 files

0.3.5

21 files

0.3.4

21 files

0.3.3

21 files

0.3.2

21 files

0.3.1

21 files

0.3.0

21 files

0.2.1

21 files

0.2.0

21 files

0.1.3

21 files

0.1.2

21 files

0.1.1

21 files

Supported by

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