tlsprint-python
Python HTTP client backed by the existing tlsprint
Go engine: uTLS, its customized HTTP/2 transport, and all 47 built-in fingerprint
presets across 13 products. The distribution name is tlsprint-python; import
it as tlsprint. The unrelated PyPI package named tlsprint must not be
installed in the same environment.
pip install tlsprint-python
Python 3.10 or newer is required. A compatible wheel contains the native engine and requires neither Go nor a C compiler at runtime. Platforms without a compatible wheel build from the source distribution and need Go >= 1.24 and a C compiler. There are no Python runtime dependencies.
The 0.1.1 wheel matrix covers these 64-bit platforms:
| Operating system | Architectures | Minimum runtime |
|---|---|---|
| Linux (glibc) | x86_64, ARM64/aarch64 | glibc 2.17 (manylinux2014) |
| macOS | Intel x86_64, Apple Silicon ARM64 | macOS 11 |
| Windows | x64/AMD64, ARM64 | Windows 10 x64 / Windows 11 ARM64 |
Each wheel is built and integration-tested on its OS and architecture, including
requests made with Go and the C compiler removed from PATH. Tests cover Python
3.10 and 3.14 (3.11 and 3.14 for Windows ARM64). 32-bit systems are not in this
release matrix. Use pip install --only-binary=:all: tlsprint-python to require
a prebuilt wheel and avoid an automatic source build.
Alpine/musl is not supported in this release: Go's c-shared runtime can crash
when loaded there (upstream issue).
The source build rejects non-glibc Linux environments. Use a glibc distribution
such as Ubuntu, Debian or RHEL; Alpine support is deferred to a separate adaptation.
import tlsprint
print([p["key"] for p in tlsprint.list_presets(product="chrome")])
print(tlsprint.get_preset("chrome-142")["version"])
with tlsprint.Session(impersonate="chrome-142", timeout=30) as session:
response = session.get("https://example.com", params={"q": "hello"})
response.raise_for_status()
print(response.status_code, response.http_version, response.text)
response = session.post("https://httpbin.org/post", json={"hello": "world"})
print(response.json())
# Convenience calls create and close a session for each request.
response = tlsprint.get("https://example.com", impersonate="firefox-145")
API
Session(impersonate="chrome", headers=None, timeout=30, proxy=None,
verify=True, http_version="auto", allow_redirects=True, cookies=True)
- Presets accept exact keys and the Go registry's aliases, including
chrome,chrome-142,firefox-145, andsafari-26.0.1. Full keys select an unambiguous capture when several presets share a version. Product aliases select the newest bundled preset, not the newest browser available online. get,post,put,patch,delete,head,options, andrequest(method, url)acceptparams,headers,data,json, andtimeout.dataaccepts bytes (including NUL bytes), strings, mappings, or form pairs.json=Noneexplicitly sends JSONnull.dataandjsonare exclusive.- Timeouts are seconds for the whole request.
Nonedisables the deadline. Each request can override the session default, including with a longer value. verify=Trueuses system trust; a PEM CA path replaces the trust pool.verify=Falsedisables target certificate verification.proxyaccepts HTTP or HTTPS proxy URLs, including basic credentials. HTTPS targets use CONNECT so their TLS handshake still comes from the preset. HTTPS proxy certificates use system trust independently of targetverify. Environment proxy variables are not read. SOCKS proxies are not supported.http_versionisauto,h1, orh2. Auto attempts HTTP/2 with the core's HTTP/1.1 fallback. Plain HTTP uses HTTP/1.1. Presets without H2 support also use HTTP/1.1;h2does not add capabilities to those presets.- Cookies persist in the Go session jar by default.
allow_redirectsandcookiesconfigure the session at construction. The core's redirect limit applies. Session headers may be changed between requests. - Responses expose
status_code,status,url,http_version,headers,content,text,encoding,elapsed(atimedelta),ok,json(), andraise_for_status(). Headers are case-insensitive;headers.get_list("set-cookie")preserves repeated values. Timeout,SSLError,ConnectionError,Cancelled,SessionClosed,InvalidArgument, andHTTPErrorare available directly fromtlsprint.HTTPError.responsecontains the response.
Scope and lifetime
The TLS engine, transport, connection pool, cookie jar and preset registry stay in Go. Python handles the public interface, argument encoding and response objects. The private C ABI exchanges JSON metadata and raw body buffers; Python always frees returned native allocations. Session handles are integer IDs, not exposed Go pointers. Calls release the Python GIL while Go runs.
A session supports concurrent requests. Configuration affecting the transport
is fixed for its lifetime; create a new session to change presets or proxies.
Do not mutate session.headers or session.timeout concurrently with requests.
Use a context manager or close() to cancel active requests and release pooled
connections. Use multiprocessing's spawn method; using the embedded Go runtime
after fork is unsupported and rejected.
This version is synchronous and buffers the whole body. It does not implement streaming, async, multipart uploads, WebSockets or HTTP/3. Large responses consume memory in both runtimes. Bodies are automatically decompressed by the Go client; response headers still describe the original encoded response. The core falls back to raw bytes for unsupported or malformed compression.
Fingerprint behavior is inherited from tlsprint, not a complete browser runtime. GREASE and cryptographic randomness vary, and fresh connections omit resumption extensions. HTTP/2 settings and ordering follow the selected preset; HTTP/1.1 header ordering is controlled by Go's standard transport. A preset's browser version label does not promise identical behavior to every feature of that browser.
Build and verify
From this directory, with Go and a C compiler installed:
uv build
uv venv .venv
uv pip install --python .venv/bin/python dist/*.whl
cd native
go build -o ../build/testserver ./testserver
go test -race ./...
cd ..
TLSPRINT_TEST_SERVER="$PWD/build/testserver" .venv/bin/python -m unittest discover -s tests -v
The source distribution contains a frozen copy of the necessary Go sources and
embedded preset data, with module checksums; it builds independently of the
original checkout. Building may download the pinned Go dependencies. Wheels are
platform-specific but independent of CPython's extension ABI (py3-none-<platform>).
Third-party license texts are included in licenses/.
The Python wheel workflow builds with cibuildwheel. Linux builds run inside manylinux containers; Windows uses a checksum-verified LLVM-MinGW toolchain. auditwheel, delocate and delvewheel check platform dependencies before installation tests run. The workflow uploads tested artifacts to GitHub; it does not hold PyPI credentials.
To run a native platform build locally from the repository root:
python -m pip install cibuildwheel==4.2.1
python -m cibuildwheel python --output-dir wheelhouse
Linux requires Docker. macOS requires Go and Xcode command-line tools. Windows
requires Go and a working MinGW-w64 C compiler selected by CC. The workflow
provides those toolchains on its native runners.
Publishing reviewed artifacts to production PyPI, after configuring uv auth
or supplying a token securely through the environment:
uv publish --username __token__ --trusted-publishing never dist/*
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tlsprint_python-0.1.1.tar.gz.
File metadata
- Download URL: tlsprint_python-0.1.1.tar.gz
- Upload date:
- Size: 227.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03f7df99b3d7bdb027c0a7b4aa4edbdca628b3e9221e53e8cceaecda1b9428da
|
|
| MD5 |
d72ee1621c959e411163cc7f51852ce3
|
|
| BLAKE2b-256 |
9950a64904160726bd6e2b1443e26ae8f4c0962c211f4f383795296c713c3dbb
|
File details
Details for the file tlsprint_python-0.1.1-py3-none-win_arm64.whl.
File metadata
- Download URL: tlsprint_python-0.1.1-py3-none-win_arm64.whl
- Upload date:
- Size: 3.0 MB
- Tags: Python 3, Windows ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
116bccb43f3c0dfef69cdfcb62d17091235b8d4314c4ce0d38c621507ed650d5
|
|
| MD5 |
d8847fb74fee99538b3e64b8ce2c6b68
|
|
| BLAKE2b-256 |
da3c29da9b218ca918e5931a4d6986333503dbc3a6dde2bc3e606c3001354489
|
File details
Details for the file tlsprint_python-0.1.1-py3-none-win_amd64.whl.
File metadata
- Download URL: tlsprint_python-0.1.1-py3-none-win_amd64.whl
- Upload date:
- Size: 3.3 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57d15cc0843a20e9ab3978ec59be9524088f064e4edf023bc492482a9ae63256
|
|
| MD5 |
ead0e7d9d4711ebee39794954ade7215
|
|
| BLAKE2b-256 |
b5e06527798b4e79fe7f58bb63e35526d8b15d1ed09202ef21f4d3eb660b030c
|
File details
Details for the file tlsprint_python-0.1.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.
File metadata
- Download URL: tlsprint_python-0.1.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
- Upload date:
- Size: 3.1 MB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86ed600ad62847cfa5081448b76d3808cb50c9244e4c8866d0b6f3779fc74ccf
|
|
| MD5 |
0bd0d08f4b2bdd5c675b9be386251bcb
|
|
| BLAKE2b-256 |
1b38f7d16cc7d78361903beb3172a7c69d7f45037e9872f73a8975c082ba044e
|
File details
Details for the file tlsprint_python-0.1.1-py3-none-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl.
File metadata
- Download URL: tlsprint_python-0.1.1-py3-none-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ec25e117064809cf92fbef386c8036bad01e15be3716037c3460fa30148dad0
|
|
| MD5 |
7cf9f7616e6885dbc11a86cc0fb773f0
|
|
| BLAKE2b-256 |
bf328d62abd6911e9f365482088f00842a7e887597040b26b254a333633e313c
|
File details
Details for the file tlsprint_python-0.1.1-py3-none-macosx_11_0_x86_64.whl.
File metadata
- Download URL: tlsprint_python-0.1.1-py3-none-macosx_11_0_x86_64.whl
- Upload date:
- Size: 3.3 MB
- Tags: Python 3, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9334c0e666ad3558001c7a97384577832ef7daf2e62951e01052e98a327e6e4
|
|
| MD5 |
a839ca2a8693b95d1775a91aaa468891
|
|
| BLAKE2b-256 |
96cc586f61b384023eab51e83fa88f052893be35f731c1bd57f057691067d547
|
File details
Details for the file tlsprint_python-0.1.1-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: tlsprint_python-0.1.1-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.1 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
055effd4ce3c832043b7a4f226b6c410e8d5e16de6e3ffb9698f5adc78190203
|
|
| MD5 |
52f6e474c5e52c53f5daf63f471e37bb
|
|
| BLAKE2b-256 |
06905fccc401ab4a212b252873cd39035fb4cd193a02900bfd3ca9585675fbe4
|