Python-TLS-Client-Async
Asyncio-first TLS client for Python with advanced fingerprinting capabilities. Modern fork of Python-TLS-Client with enhanced features and active maintenance.
from async_tls_client import AsyncClient
import asyncio
async def main():
async with AsyncClient(
client_identifier="chrome120",
random_tls_extension_order=True
) as client:
response = await client.get("https://tls.peet.ws/api/all")
print(f"Detected TLS fingerprint: {response.json()['tls']['ja3_hash']}")
asyncio.run(main())
Features ✨
- Full Async Support: Built with asyncio for high-performance concurrent requests
- Modern TLS Fingerprinting: JA3, JA4, HTTP/2 fingerprints and TLS 1.3 support
- Client Profiles: 50+ preconfigured clients (Chrome, Firefox, Safari, iOS, Android)
- Advanced Configuration:
- Custom TLS cipher suites & extensions
- HTTP/2 and QUIC protocol support
- Certificate pinning and compression
- Proxy support (HTTP/S, SOCKS4/5)
- Auto-Cookie Management: Session persistence with configurable cookie jars
- Request Manipulation: Header ordering, pseudo-header customization, and priority control
Why This Fork? 🚀
The fork was created due to the lack of updates in the original repository, while the underlying GoLang library tls-client continues to evolve actively. This project aims to keep up with the latest developments in the GoLang library and provide a modern, asynchronous interface for Python users.
Recommendations:
- Monitor changelogs for deprecation warnings in future minor releases
- Avoid direct reliance on internal modules like
async_tls_client.structuresorasync_tls_client.cookies - Consider contributing feedback on the proposed changes through GitHub issues
Installation 📦
pip install async_tls_client
Quickstart 🚀
Basic Usage
from async_tls_client import AsyncClient
import asyncio
async def main():
async with AsyncClient("chrome120") as client:
response = await client.get(
"https://httpbin.org/json",
headers={"X-API-Key": "secret"},
proxy="http://user:pass@proxy:port"
)
print(f"Status: {response.status_code}")
print(f"Headers: {response.headers}")
print(f"JSON: {response.json()}")
asyncio.run(main())
Advanced Configuration
from async_tls_client import AsyncClient
client = AsyncClient(
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
},
supported_signature_algorithms=[
"ECDSAWithP256AndSHA256",
"PSSWithSHA256",
"PKCS1WithSHA256",
"ECDSAWithP384AndSHA384",
"PSSWithSHA384",
"PKCS1WithSHA512",
],
certificate_pinning={
"example.com": [
"sha256/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
]
}
)
Client Profiles 🕶️
Preconfigured client identifiers (https://github.com/bogdanfinn/tls-client/blob/master/profiles/profiles.go):
| Browser/Framework | Available Profiles |
|---|---|
| Chrome | chrome_103 - chrome_133 (including PSK variants: 116_PSK, 116_PSK_PQ, 131_PSK, 133_PSK) |
| Firefox | firefox_102 - firefox_135 |
| Safari (Desktop) | safari_15_6_1, safari_16_0, safari_ipad_15_6 |
| Safari (iOS) | safari_ios_15_5 - safari_ios_18_0 |
| Opera | opera_89 - opera_91 |
| Android (OkHttp) | okhttp4_android_7 - okhttp4_android_13 |
| iOS (Custom) | mms_ios (v1, v2, v3), mesh_ios (v1, v2), confirmed_ios, zalando_ios_mobile, nike_ios_mobile |
| Android (Custom) | mesh_android (v1, v2), confirmed_android, zalando_android_mobile, nike_android_mobile |
| Cloudflare | cloudscraper |
Advanced Features 🔧
Custom Fingerprint Configuration
client = AsyncClient(
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_order=["HEADER_TABLE_SIZE", "MAX_CONCURRENT_STREAMS"],
pseudo_header_order=[":method", ":authority", ":scheme", ":path"],
header_order=["accept", "user-agent", "accept-encoding"],
force_http1=False,
cert_compression_algo="brotli"
)
Certificate Pinning
client = AsyncClient(
certificate_pinning={
"api.bank.com": [
"sha256/7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y=",
"sha256/YLh1dUR9y6Kja30RrAn7JKnbQG/uEtLMkBgFF2Fuihg="
]
}
)
Proxy Support
response = await client.get(
"https://api.example.com",
proxy="socks5://user:pass@proxy:1080"
)
Asynchronous Design 🚧
The client leverages Python's asyncio through three key strategies:
-
Non-blocking I/O
- Network operations run in separate threads using
asyncio.to_thread - Go TLS client handles remain managed in background executors
- Network operations run in separate threads using
-
Session Management
AsyncClientcontext manager handles automatic cleanup- Connection pooling with automatic keep-alives
- Cookie persistence across requests
-
Resource Optimization
- Zero-copy body handling for large responses
- Lazy initialization of heavy resources
- Automatic memory cleanup of Go pointers
Packaging 📦
When using PyInstaller/PyArmor, include the shared library:
Windows
--add-binary 'async_tls_client/dependencies/tls-client-64.dll;async_tls_client/dependencies'
Linux
--add-binary 'async_tls_client/dependencies/tls-client-x86.so:async_tls_client/dependencies'
macOS
--add-binary 'async_tls_client/dependencies/tls-client-arm64.dylib:async_tls_client/dependencies'
Acknowledgements 🙏
- Original Python implementation: FlorianREGAZ/Python-Tls-Client
- Core TLS implementation: bogdanfinn/tls-client
- Inspiration: psf/requests
License 📄
MIT License - See LICENSE for details
Metadata
Release files for async-tls-client 2.2.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 | Provenance | Actions |
|---|---|---|---|---|
| async_tls_client-2.2.0.tar.gz | 45.4 MB | Without provenance | Details for async_tls_client-2.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| async_tls_client-2.2.0-py3-none-any.whl | Python 3 | none | any | Details for async_tls_client-2.2.0-py3-none-any.whl |
Total release size: 91.0 MB
Release files / async_tls_client-2.2.0.tar.gz
| Download URL | async_tls_client-2.2.0.tar.gz |
|---|---|
| Size | 45.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cbe3d64c58b9d2274d6122faddded718d1f10606ad94ef44dc05e139e94c48c9
|
|
BLAKE2b-256 checksum How to use checksums |
84ecb41d435aa1690a318073895efc146697188f57f92de0c40d12dc73f0be80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / async_tls_client-2.2.0-py3-none-any.whl
| Download URL | async_tls_client-2.2.0-py3-none-any.whl |
|---|---|
| Size | 45.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aeff7d84c2e5485efc537a1e42e026a9620ecb06adc47cac9524a3c30cd7f83f
|
|
BLAKE2b-256 checksum How to use checksums |
ce28ea9f0203c858b67643c3e5b44d0cc324f6e02d45aea08a77f78544ca87e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for async-tls-client 2.2.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.