Skip to main content

tlsfp (Python)

tlsfp is a browser-accurate TLS/HTTP client. The C++ core emits the exact ClientHello and HTTP frames a real browser emits, so the server sees the same JA3 / JA4 / Akamai H2 fingerprint as Chrome 157, Firefox 160, Firefox 151 or Edge 152 — not Python's.

The Python layer is a pure standard-library ctypes binding around the libtlsfp.so C ABI: no compiled extension, no third-party package, no monkey-patching.

from tlsfp import Session

with Session(profile="chrome-157", proxy="http://127.0.0.1:7897") as s:
    r = s.get("https://tls.peet.ws/api/all")
    print(r.status_code, r.http_version, r.ja4)
    print(r.json()["tls"]["ja4"])

Install

pip install tlsfp

Two artifacts are published for 4.11.0:

artifact platform what it needs at runtime
tlsfp-4.11.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl Linux x86-64, glibc >= 2.28 (Ubuntu 20.04+, Debian 11+, RHEL/Alma/Rocky 8+, Arch, Manjaro) nothing: libtlsfp.so, OpenSSL 4.1, nghttp2, brotli and zstd are bundled inside the wheel
tlsfp-4.11.0.tar.gz (sdist) Linux x86-64 (other architectures if the C++ core builds there) a C++20 compiler, CMake >= 3.20, and the development packages of OpenSSL (>= 3.0), nghttp2, brotli, zlib, plus nlohmann-json

pip picks the wheel when the platform matches and falls back to the sdist. For the sdist on Debian/Ubuntu:

sudo apt install build-essential cmake libssl-dev libnghttp2-dev libbrotli-dev \
                 zlib1g-dev libzstd-dev nlohmann-json3-dev
pip install tlsfp --no-binary tlsfp   # force a source build

There is no Windows or macOS build in 4.11.0: the core is Linux/epoll only.

Where the library comes from

The binding loads libtlsfp.so in this order: $TLSFP_LIB, then libtlsfp.so next to the module (what the wheel installs), then ../build/libtlsfp.so, ../build/libtlsfp.so.4, ../../lib/libtlsfp.so, then the system loader path. Set TLSFP_LIB to point at your own build of the C library and the Python side will use it unchanged.

Entry points

import what it does
tlsfp.Session requests-style client: get/post/put/delete/head/request, Response.status_code/.headers/.text/.json()/.content, cookie jar, proxies (http://, socks5://), redirects, per-request timeouts, stream=True + iter_content(), WebSocket helper
tlsfp_multi.BatchProbeSession batch status/timing/byte probe over one C++ reactor for a URL list: await s.gather(urls) / async for r in s.stream(urls) with max_inflight (use it as a plain with block); response bodies are not buffered — use tlsfp.Session for content
tlsfp_reuse.ReuseSession keep-alive connection reuse: HTTP/2 multiplexing on one TLS session, h1 keep-alive, per-result reused/mux flags and stats()
tlsfp.AsyncSession asyncio client over the native extension's pool — not usable in 4.11.0, see below

Error classes (tlsfp.Timeout, tlsfp.CertificateError, tlsfp.ConnectError, ...) carry the C ABI status code in .status.

Built-in profiles: chrome-157, chrome-157-linux, firefox-160, firefox-151, edge-152. Session(profile="FILE.json") loads or extends a profile from disk.

Upgrading from 4.0.0

  • Python API break: tlsfp_multi.MultiAsyncSession is now BatchProbeSession. No alias is kept, because the old name described the wrong concurrency model (one C++ reactor, not an asyncio session); rename the import if you used it. Constructor and methods are unchanged.
  • Everything else is additive: every upstream change since 4.10.0 is included (per-origin max_conns, TLS 1.2 downgrade caching and negative-dial suppression, HTTP/1.1 responses without a body, RST_STREAM(CANCEL) on max_body, tunnel-level reuse with health rotation, and a trust-store lookup that finds the distro CA bundle even when the wheel bundles its own OpenSSL).
  • The C ABI is unchanged: TLSFP_ABI_VERSION is still 1 and the SONAME is still libtlsfp.so.4, so a program built against 4.0.0 keeps working.

What 4.11.0 does not include

  • the optional native extension _tlsfp_native (-DTLSFP_PYTHON=ON, TLSFP_NATIVE=1). tlsfp.native_available() is False and tlsfp.AsyncSession(...) raises ModuleNotFoundError: _tlsfp_native, because this release deliberately ships only the ctypes path. Use tlsfp_multi.BatchProbeSession or tlsfp_reuse.ReuseSession for concurrent work; build the core yourself with -DTLSFP_PYTHON=ON if you need the native class or AsyncSession;
  • HTTP/3 (--http3) and its profiles;
  • the BoringSSL TLS 1.2 backend and the TLS 1.0/1.1 legacy transport;
  • the requests drop-in shim (python/compat), which is source-only.

Python 3.9 is the floor claimed by the metadata; the wheel itself is py3-none because the binding is pure Python, so any CPython 3 on a matching platform can install it.

Fingerprint parity depends on the bundled OpenSSL

Chrome 157 and Firefox 160 offer the hybrid post-quantum group X25519MLKEM768 (0x11ec). It is only implemented by OpenSSL >= 3.5. The wheel bundles OpenSSL 4.1, so the wheel sends a real ML-KEM key share, exactly like a current browser. A source build against an older system OpenSSL still links and runs, but that group gets no key share; JA3/JA4/Akamai signatures are unchanged (they hash extension types, cipher lists and ALPN, not key-share payloads), so only post-quantum confidentiality is lost. Use tlsfp.version() and tlsfp.ABI_VERSION at runtime to see what is loaded.

License

No LICENSE file ships in the repository or in this artifact, so no license is granted for redistribution or commercial use by this package alone.

Documentation

The repository ships the full C++ and Python documentation (docs/PYTHON.md, docs/C-ABI.md, docs/HTTP-CLIENT.md, docs/COOKIES.md, ...). The Python binding is generated from, and stays in lockstep with, the stable C ABI described in docs/C-ABI.md.

Metadata

Release files for tlsfp 4.11.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 tlsfp 4.11.0
File Size Uploaded Provenance Actions
tlsfp-4.11.0.tar.gz 1.2 MB Without provenance Details for tlsfp-4.11.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tlsfp 4.11.0
File Interpreter ABI Platform Actions
tlsfp-4.11.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.26+ x86-64, Linux glibc 2.28+ x86-64 Details for tlsfp-4.11.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Total release size: 5.4 MB

Release files / tlsfp-4.11.0.tar.gz

Download URL tlsfp-4.11.0.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
4cce1dcd6207938687519c1e50baa67b9bf56338175791258931c08889bf5373
BLAKE2b-256 checksum
How to use checksums
05f714d765a3ec7843d2ae39b0f254d624d064930bc5ce54695291c3e4b2d26b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Release files / tlsfp-4.11.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Download URL tlsfp-4.11.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Size 4.2 MB
Tags Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
27eb8689595524ece4068a11fcf2566789fcaaf26fb567b18bb5774b22a46183
BLAKE2b-256 checksum
How to use checksums
0bce39cf0963964c07c22dce02f7528a4ca8a754d5ac07eb7aaf451b069cb9cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Security for tlsfp 4.11.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

4.11.0 This release

2 release files No 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