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.0.0:

artifact platform what it needs at runtime
tlsfp-4.0.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.0.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.0.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.MultiAsyncSession asyncio client 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)
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.0.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.

What 4.0.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.MultiAsyncSession 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.0.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.0.0
File Size Uploaded Provenance Actions
tlsfp-4.0.0.tar.gz 1.2 MB Without provenance Details for tlsfp-4.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tlsfp 4.0.0
File Interpreter ABI Platform Actions
tlsfp-4.0.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.0.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Total release size: 5.4 MB

Release files / tlsfp-4.0.0.tar.gz

Download URL tlsfp-4.0.0.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
26437368e1b74d5ed99abc608f466f411ed73fbbd3b9b46b53573e8ab5833afb
BLAKE2b-256 checksum
How to use checksums
b21eddd331dee83f878b635aa64ed74595755407eac70b501250e0231008793a
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.0.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Download URL tlsfp-4.0.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
c7315d6b13894cbfb6e4994e73bbc90b860c5d3bf385ef59a3fa4baff1221137
BLAKE2b-256 checksum
How to use checksums
7a52ef6f32ef6d0b7a03283a0466008fef8aba22b509b5f234032e21b5ea8194
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.0.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.0.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