Python-TLS-Client
Python-TLS-Client is an advanced HTTP library based on requests and tls-client.
Installation
pip install tls-client
Examples
The syntax is inspired by requests, so its very similar and there are only very few things that are different.
Example 1 - Preset:
import tls_client
# `client_identifier` picks the browser profile to impersonate, e.g. chrome_120, firefox_120, safari_ios_17_0 or
# okhttp4_android_13. Every supported name is listed in tls_client/settings.py; unknown names raise a ValueError.
session = tls_client.Session(
client_identifier="chrome_112",
random_tls_extension_order=True
)
res = session.get(
"https://www.example.com/",
headers={
"key1": "value1",
},
proxy="http://user:password@host:port"
)
Example 2 - Custom:
import tls_client
session = tls_client.Session(
# None switches from a preset to the settings below. Without it they are all ignored.
client_identifier=None,
ja3_string="771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-17513,29-23-24,0",
h2_settings={
"HEADER_TABLE_SIZE": 65536,
"MAX_CONCURRENT_STREAMS": 1000,
"INITIAL_WINDOW_SIZE": 6291456,
"MAX_HEADER_LIST_SIZE": 262144
},
h2_settings_order=[
"HEADER_TABLE_SIZE",
"MAX_CONCURRENT_STREAMS",
"INITIAL_WINDOW_SIZE",
"MAX_HEADER_LIST_SIZE"
],
supported_signature_algorithms=[
"ECDSAWithP256AndSHA256",
"PSSWithSHA256",
"PKCS1WithSHA256",
"ECDSAWithP384AndSHA384",
"PSSWithSHA384",
"PKCS1WithSHA384",
"PSSWithSHA512",
"PKCS1WithSHA512",
],
supported_versions=["GREASE", "1.3", "1.2"],
key_share_curves=["GREASE", "X25519"],
cert_compression_algo="brotli",
# The JA3 contains ALPN (16) and ALPS (17513), these fill them in.
alpn_protocols=["h2", "http/1.1"],
alps_protocols=["h2"],
pseudo_header_order=[
":method",
":authority",
":scheme",
":path"
],
connection_flow=15663105,
header_order=[
"accept",
"user-agent",
"accept-encoding",
"accept-language"
]
)
res = session.post(
"https://www.example.com/",
headers={
"key1": "value1",
},
json={
"key1": "key2"
}
)
Example 3 - Async:
import asyncio
import tls_client
async def main():
# Takes the same arguments as tls_client.Session.
async with tls_client.AsyncSession(client_identifier="chrome_120") as session:
responses = await asyncio.gather(
*(session.get(f"https://www.example.com/{i}") for i in range(10))
)
print([res.status_code for res in responses])
asyncio.run(main())
Pyinstaller / Pyarmor
If you want to pack the library with Pyinstaller or Pyarmor, make sure to add this to your command:
Linux with glibc (e.g. Ubuntu, Debian) / x86_64:
--add-binary '{path_to_library}/tls_client/dependencies/tls-client-linux-ubuntu-amd64.so:tls_client/dependencies'
Linux / ARM64:
--add-binary '{path_to_library}/tls_client/dependencies/tls-client-linux-arm64.so:tls_client/dependencies'
macOS on Intel x86 based Macs (pre-M1):
--add-binary '{path_to_library}/tls_client/dependencies/tls-client-darwin-amd64.dylib:tls_client/dependencies'
macOS on Apple Silicon (M1 and later):
--add-binary '{path_to_library}/tls_client/dependencies/tls-client-darwin-arm64.dylib:tls_client/dependencies'
Windows / 64-bit:
--add-binary '{path_to_library}/tls_client/dependencies/tls-client-windows-64.dll;tls_client/dependencies'
Windows / 32-bit:
--add-binary '{path_to_library}/tls_client/dependencies/tls-client-windows-32.dll;tls_client/dependencies'
Acknowledgements
Big shout out to Bogdanfinn for open sourcing his tls-client in Golang. Also I wanted to keep the syntax as similar as possible to requests, as most people use it and are familiar with it!
Metadata
Release files for tls-client 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tls_client-2.0.0.tar.gz | 26.8 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| tls_client-2.0.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| tls_client-2.0.0-py3-none-win32.whl | Python 3 | none | Windows x86-32 | Details |
| tls_client-2.0.0-py3-none-manylinux_2_17_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details |
| tls_client-2.0.0-py3-none-manylinux_2_17_i686.whl | Python 3 | none | Linux glibc 2.17+ x86-32 | Details |
| tls_client-2.0.0-py3-none-manylinux_2_17_armv7l.whl | Python 3 | none | Linux glibc 2.17+ ARMv7l | Details |
| tls_client-2.0.0-py3-none-manylinux_2_17_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| tls_client-2.0.0-py3-none-macosx_13_0_x86_64.whl | Python 3 | none | macOS 13.0+ x86-64 | Details |
| tls_client-2.0.0-py3-none-macosx_13_0_arm64.whl | Python 3 | none | macOS 13.0+ ARM64 | Details |
Total release size: 59.2 MB
Release files / tls_client-2.0.0.tar.gz
| Download URL | tls_client-2.0.0.tar.gz |
|---|---|
| Size | 26.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
168caf1d41051088c20c46173ca87c1941d345ba8bc039319055bbf5986a1cb6
|
|
BLAKE2b-256 checksum How to use checksums |
ed2b4e8822b4f75a74c4d81d8a7ad172344d020c0ab27179d4a742e8b5c0e2c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 10, 2026.
Transparency logRelease files / tls_client-2.0.0-py3-none-win_amd64.whl
| Download URL | tls_client-2.0.0-py3-none-win_amd64.whl |
|---|---|
| Size | 8.4 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1518f81e2007634d22b87fcdc04c6d21d40ff45eb1d745494d0937aa49b424ae
|
|
BLAKE2b-256 checksum How to use checksums |
cb83392dd8c4079a09d2c079b044902b0960a28d0fc5215efb17d5f8a5be51ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 10, 2026.
Transparency logRelease files / tls_client-2.0.0-py3-none-win32.whl
| Download URL | tls_client-2.0.0-py3-none-win32.whl |
|---|---|
| Size | 8.3 MB |
| Tags | Python 3 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
74bb3f7ab0c4da5d9491214f2c5086d069d10748b1b2d55f5b34d2ce25195801
|
|
BLAKE2b-256 checksum How to use checksums |
a7e5ed7fc01c7bb893389cd9b9ef612b9796430c5c4db373465cecd24066ceb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 10, 2026.
Transparency logRelease files / tls_client-2.0.0-py3-none-manylinux_2_17_x86_64.whl
| Download URL | tls_client-2.0.0-py3-none-manylinux_2_17_x86_64.whl |
|---|---|
| Size | 8.5 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
c7d5f44160d2991fdde017e5e2f951138c2896c4e0fba58750932fae8ebafff3
|
|
BLAKE2b-256 checksum How to use checksums |
f12349c35ca3822c833eb9863417efd17735cc6c4d7a85aa8b8f7f5954610874
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 10, 2026.
Transparency logRelease files / tls_client-2.0.0-py3-none-manylinux_2_17_i686.whl
| Download URL | tls_client-2.0.0-py3-none-manylinux_2_17_i686.whl |
|---|---|
| Size | 8.6 MB |
| Tags | Linux glibc 2.17+ x86-32 Python 3 |
|
SHA-256 checksum How to use checksums |
85826d9b6153d5f85f13dea4d1d028a595fd938f6e0e64a15082178faaea59a4
|
|
BLAKE2b-256 checksum How to use checksums |
32d0a35e95a63216b9d7e243fe7592642da0ca7a5b50553ec4c9e350b19edc8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 10, 2026.
Transparency logRelease files / tls_client-2.0.0-py3-none-manylinux_2_17_armv7l.whl
| Download URL | tls_client-2.0.0-py3-none-manylinux_2_17_armv7l.whl |
|---|---|
| Size | 8.1 MB |
| Tags | Linux glibc 2.17+ ARMv7l Python 3 |
|
SHA-256 checksum How to use checksums |
c8b7ed5dbdfb499354053df9dac55434db88b5faae0c9eed7db725edcb6ea9e7
|
|
BLAKE2b-256 checksum How to use checksums |
77a4cb8e19650cc807f3d1e401bf250432f2d9093d19ae163785d98a758bfa92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 10, 2026.
Transparency logRelease files / tls_client-2.0.0-py3-none-manylinux_2_17_aarch64.whl
| Download URL | tls_client-2.0.0-py3-none-manylinux_2_17_aarch64.whl |
|---|---|
| Size | 7.9 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
c867ebea7006d7cca4e7337241990e28473a0e6409046ad5c37770816cbc9510
|
|
BLAKE2b-256 checksum How to use checksums |
ab9bad92ebea9615a77897c0f7985ae1f8bf05cbf2a32fdfe2d3372cc68e3699
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 10, 2026.
Transparency logRelease files / tls_client-2.0.0-py3-none-macosx_13_0_x86_64.whl
| Download URL | tls_client-2.0.0-py3-none-macosx_13_0_x86_64.whl |
|---|---|
| Size | 4.8 MB |
| Tags | Python 3 macOS 13.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
fc550b5fce1908bc384bd6da4cb2c8ab80ff22835dc13ec6a1f2f664a7a9fb05
|
|
BLAKE2b-256 checksum How to use checksums |
c9769ed7176ccb96da57cee459c078f87e552a68190dd2db7446389179de8adb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 10, 2026.
Transparency logRelease files / tls_client-2.0.0-py3-none-macosx_13_0_arm64.whl
| Download URL | tls_client-2.0.0-py3-none-macosx_13_0_arm64.whl |
|---|---|
| Size | 4.5 MB |
| Tags | Python 3 macOS 13.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
287558e61d394c5d0435ab62ac67abfbc8ec0dd81330eaad79cd3f4d825a278b
|
|
BLAKE2b-256 checksum How to use checksums |
c3707fb659500856d39c587e86dc2a774b626596ea83458c315dc91111464223
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 10, 2026.
Transparency log