- Notifications
You must be signed in to change notification settings - Fork5
Async fork of Python-TLS-Client with modern asyncio support, updated dependencies, and fixes for issues in the original abandoned library. Includes enhanced compatibility, stability improvements, and ongoing maintenance for Python 3.9–3.13.
License
diprog/python-tls-client-async
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Asyncio-first TLS client for Python with advanced fingerprinting capabilities. Modern forkofPython-TLS-Client with enhanced features and active maintenance.
fromasync_tls_clientimportAsyncClientimportasyncioasyncdefmain():asyncwithAsyncClient(client_identifier="chrome120",random_tls_extension_order=True )asclient:response=awaitclient.get("https://tls.peet.ws/api/all")print(f"Detected TLS fingerprint:{response.json()['tls']['ja3_hash']}")asyncio.run(main())
- 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
The fork was created due to the lack of updates in the original repository, while the underlying GoLanglibrarytls-client continues to evolve actively. This project aims to keepup with the latest developments in the GoLang library and provide a modern, asynchronous interface for Python users.
- 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
pip install async_tls_client
fromasync_tls_clientimportAsyncClientimportasyncioasyncdefmain():asyncwithAsyncClient("chrome120")asclient:response=awaitclient.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())
fromasync_tls_clientimportAsyncClientclient=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=" ] })
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 |
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")
client=AsyncClient(certificate_pinning={"api.bank.com": ["sha256/7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y=","sha256/YLh1dUR9y6Kja30RrAn7JKnbQG/uEtLMkBgFF2Fuihg=" ] })
response=awaitclient.get("https://api.example.com",proxy="socks5://user:pass@proxy:1080")
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
When using PyInstaller/PyArmor, include the shared library:
--add-binary'async_tls_client/dependencies/tls-client-64.dll;async_tls_client/dependencies'--add-binary'async_tls_client/dependencies/tls-client-x86.so:async_tls_client/dependencies'--add-binary'async_tls_client/dependencies/tls-client-arm64.dylib:async_tls_client/dependencies'- Original Python implementation:FlorianREGAZ/Python-Tls-Client
- Core TLS implementation:bogdanfinn/tls-client
- Inspiration:psf/requests
MIT License - SeeLICENSE for details
About
Async fork of Python-TLS-Client with modern asyncio support, updated dependencies, and fixes for issues in the original abandoned library. Includes enhanced compatibility, stability improvements, and ongoing maintenance for Python 3.9–3.13.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Languages
- Python99.8%
- Batchfile0.2%