Python-TLS-Client is an advanced HTTP library based on requests and tls-client.
pip install tls-client
The syntax is inspired by requests, so its very similar and there are only very few things that are different.
Example - Preset:
import tls_client
# `client_identifier` picks the browser profile to impersonate, e.g. chrome_152, firefox_148, safari_ios_26_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_152",
random_tls_extension_order=True
)
res = session.get(
"https://www.example.com/",
headers={
"key1": "value1",
},
proxy="http://user:password@host:port"
)More examples:
- Custom TLS fingerprint
- Certificate pinning
- File upload
- Async
- Redirects and cookies
- Downloads and encodings
- Multiprocessing
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!