Skip to main content

fasthttpc

CI PyPI Python versions License: MIT Docs

English | Türkçe

A pure-Python HTTP client with its own TLS 1.3 / TLS 1.2 stack, browser TLS and HTTP/2 fingerprint impersonation (Chrome, Firefox, Safari), HTTP/2 multiplexing, and a synchronous and an asyncio API. No C extension of its own: the only compiled dependency is cryptography for primitives (AEAD, X25519, certificate parsing).

Status: experimental (alpha). The TLS stack is written from scratch and has not been independently security-audited. For critical production traffic prefer a mature client such as curl_cffi, httpx or requests. See Security model and Known limits.

Install

pip install fasthttpc
pip install "fasthttpc[brotli,zstd]"   # optional content decoders

Python 3.10 - 3.13 on Linux, macOS and Windows.

Quick start

from fasthttpc import Session

with Session(impersonate="chrome_131") as s:
    r = s.get("https://httpbin.org/get")
    print(r.status_code, r.elapsed)
    print(r.json())

Async:

import asyncio
from fasthttpc import AsyncSession

async def main():
    async with AsyncSession(impersonate="chrome_131") as s:
        rs = await asyncio.gather(*(s.get(f"https://httpbin.org/anything/{i}") for i in range(5)))
        print([r.status_code for r in rs])

asyncio.run(main())

Offline testing:

from fasthttpc import Session, Response, MockTransport

transport = MockTransport(lambda request: Response(200, body=b'{"ok": true}',
                                                   headers={"Content-Type": "application/json"}))
with Session(transport=transport) as s:
    assert s.get("https://api.example.com/").json() == {"ok": True}

Features

Area Support
Protocols HTTP/1.1 (keep-alive, chunked), HTTP/2 (multiplexing, flow control, GOAWAY), WebSocket (ws://, wss://)
TLS Own TLS 1.3 (HelloRetryRequest, key_share x25519/secp256r1/secp384r1) and a safe subset of TLS 1.2 (ECDHE + AEAD, EMS required)
Server authentication Chain + hostname, CertificateVerify, Finished, all mandatory; verify= custom CA bundle
Fingerprints chrome_131, firefox_133, safari_18 profiles: ClientHello (JA3/JA4), HTTP/2 SETTINGS, pseudo-header order, header order
Async AsyncSession with the same fingerprinting and real HTTP/2 multiplexing
Proxies HTTP CONNECT (+Basic), SOCKS5 (RFC 1929), rotation; TLS always terminates inside the tunnel
Timeouts / limits / retries Timeout, Limits, urllib3-style Retry with Retry-After
Cookies, cache, redirects RFC 6265 cookie jar, response cache, redirect history
DNS Optional DNS-over-HTTPS resolver
Testing MockTransport (sync and async handlers)
Typing Ships py.typed

How it compares

Honest comparison; "maturity" matters as much as features here.

fasthttpc requests httpx curl_cffi
Implementation Pure Python + cryptography Pure Python + urllib3 + ssl Pure Python + h11/h2 + ssl libcurl-impersonate (C) via cffi
TLS library Own TLS 1.3/1.2 code OpenSSL via ssl OpenSSL via ssl BoringSSL
Browser TLS/JA3/JA4 impersonation Yes (3 families) No No Yes (many versions, best coverage)
HTTP/2 fingerprint Yes No No Yes
HTTP/2 Yes No Yes Yes
HTTP/3 Not yet No No Yes
Async Yes (asyncio) No Yes (asyncio, trio via anyio) Yes
verify=False Not supported by design Yes Yes Yes
Session resumption / 0-RTT No Yes (OpenSSL) Yes (OpenSSL) Yes
Post-quantum key exchange No via OpenSSL 3.5+ via OpenSSL 3.5+ Yes
Maturity / production use Alpha, young, no external audit Very mature Mature Mature
Years of real-world hardening None >10 >5 Several
Speed Pure Python: slower on bulk transfers Fast enough Fast enough Fastest

Choose fasthttpc if you want a dependency-light, readable, inspectable client whose TLS fingerprint you can control precisely, or you cannot ship C extensions. Choose curl_cffi if you need the widest and most up-to-date fingerprint coverage or maximum performance. Choose requests/httpx when you do not need impersonation.

Security model

Every TLS 1.3 connection authenticates the server with three independent checks, all mandatory:

Check What it proves
Certificate chain A trusted CA signed the certificate, hostname matches, validity period
CertificateVerify The peer holds the certificate's private key (RFC 8446 section 4.4.3)
Server Finished The handshake transcript was not tampered with (section 4.4.4)

Trust anchors are the certifi bundle plus the system store, or exactly the PEM file you pass as verify="ca.pem". verify=False is not supported and raises ValueError; pass the CA (or the self-signed certificate) you want to trust instead. TLS 1.2 additionally enforces Extended Master Secret, renegotiation_info, DOWNGRD sentinel detection and rejects CBC, static RSA, DHE and SHA-1 signatures.

What this does not give you: an independent audit, constant-time guarantees beyond what cryptography provides, or protection from implementation bugs in a young protocol stack. Report vulnerabilities privately via GitHub security advisories.

Known limits

  • No session resumption (PSK) and no 0-RTT: every connection does a full handshake.
  • No post-quantum / hybrid key shares (X25519MLKEM768), no secp521r1/ffdhe.
  • TLS 1.2: only ECDHE + AES-GCM / ChaCha20-Poly1305; CBC and older suites are rejected with an explicit error.
  • HPACK Huffman encoding is not implemented (decoding is); this causes a tiny HTTP/2 fingerprint deviation.
  • HTTP/2 server push is a protocol error (ENABLE_PUSH=0); PRIORITY is not sent.
  • Session is not thread-safe: use one per thread.
  • Timeout.write is not enforced separately on the sync side.
  • Only 3 browser families are modelled; profiles are snapshots and age.
  • Pure-Python crypto framing is slower than OpenSSL for large bulk transfers.

The full, detailed list is in README.tr.md and the documentation.

Documentation

Quick start, async usage, profiles, proxies, TLS, HTTP/2, testing, migration guides and the API reference live at https://bu-ra34.github.io/fasthttpc/ (sources in docs/).

Development

git clone https://github.com/bu-ra34/fasthttpc && cd fasthttpc
pip install -e ".[dev]"
pytest            # offline unit tests
ruff check .
mypy
mkdocs serve      # needs: pip install -e ".[docs]"

License

MIT. See LICENSE.

Metadata

Release files for fasthttpc 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fasthttpc 0.6.0
File Size Uploaded Provenance Actions
fasthttpc-0.6.0.tar.gz 383.9 kB With provenance Details for fasthttpc-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fasthttpc 0.6.0
File Interpreter ABI Platform Actions
fasthttpc-0.6.0-py3-none-any.whl Python 3 none any Details for fasthttpc-0.6.0-py3-none-any.whl

Total release size: 649.5 kB

Release files / fasthttpc-0.6.0.tar.gz

Download URL fasthttpc-0.6.0.tar.gz
Size 383.9 kB
Tags Source
SHA-256 checksum
How to use checksums
acc548cdb9c3da4b6019b396fad9056d0d4cd0ba474763a890a5625cd2363ceb
BLAKE2b-256 checksum
How to use checksums
354708ecb97ed5e6aac4b4b92cfadfed336140f1ce28633a34eb764248bde506
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / fasthttpc-0.6.0-py3-none-any.whl

Download URL fasthttpc-0.6.0-py3-none-any.whl
Size 265.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6a4fc7e2f3c32110ffe1cbd175a14201744f9d6cfe1aef537bbc6b2df8b7b13
BLAKE2b-256 checksum
How to use checksums
a89ed86fa14a38050c0279353bcdc5eb9904aa3ad8b6a16ba0775a5dbabbfb64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for fasthttpc 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fasthttpc-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page