44[ ![ Python versions] ( https://img.shields.io/pypi/pyversions/async_tls_client.svg )] ( https://pypi.org/project/async_tls_client/ )
55[ ![ License] ( https://img.shields.io/badge/license-MIT-blue.svg )] ( https://opensource.org/licenses/MIT )
66
7- Asyncio-first TLS client for Python with advanced fingerprinting capabilities. Modern fork of [ Python-TLS-Client] ( https://github.com/FlorianREGAZ/Python-Tls-Client ) with enhanced features and active maintenance.
7+ Asyncio-first TLS client for Python with advanced fingerprinting capabilities. Modern fork
8+ of [ Python-TLS-Client] ( https://github.com/FlorianREGAZ/Python-Tls-Client ) with enhanced features and active maintenance.
89
910``` python
1011from async_tls_client import AsyncClient
1112import asyncio
1213
14+
1315async def main ():
1416 async with AsyncClient(
15- client_identifier = " chrome120" ,
16- random_tls_extension_order = True
17+ client_identifier = " chrome120" ,
18+ random_tls_extension_order = True
1719 ) as client:
1820 response = await client.get(" https://tls.peet.ws/api/all" )
1921 print (f " Detected TLS fingerprint: { response.json()[' tls' ][' ja3_hash' ]} " )
2022
23+
2124asyncio.run(main())
2225```
2326
@@ -27,10 +30,10 @@ asyncio.run(main())
2730- ** Modern TLS Fingerprinting** : JA3, JA4, HTTP/2 fingerprints and TLS 1.3 support
2831- ** Client Profiles** : 50+ preconfigured clients (Chrome, Firefox, Safari, iOS, Android)
2932- ** Advanced Configuration** :
30- - Custom TLS cipher suites & extensions
31- - HTTP/2 and QUIC protocol support
32- - Certificate pinning and compression
33- - Proxy support (HTTP/S, SOCKS4/5)
33+ - Custom TLS cipher suites & extensions
34+ - HTTP/2 and QUIC protocol support
35+ - Certificate pinning and compression
36+ - Proxy support (HTTP/S, SOCKS4/5)
3437- ** Auto-Cookie Management** : Session persistence with configurable cookie jars
3538- ** Request Manipulation** : Header ordering, pseudo-header customization, and priority control
3639
@@ -40,6 +43,38 @@ The fork was created due to the lack of updates in the original repository, whil
4043library [ tls-client] ( https://github.com/bogdanfinn/tls-client ) continues to evolve actively. This project aims to keep
4144up with the latest developments in the GoLang library and provide a modern, asynchronous interface for Python users.
4245
46+ ## Upcoming Breaking Changes 🚧
47+
48+ The library plans several breaking changes in future major releases to improve maintainability and reduce technical
49+ debt:
50+
51+ ### Key Changes Planned:
52+
53+ 1 . ** Syntax Divergence from ` requests ` **
54+ - The API will evolve to be less similar to ` requests ` to avoid dependency on its internal implementations.
55+ - This may affect session/request patterns and method signatures.
56+
57+ 2 . ** Direct Import of ` CaseInsensitiveDict ` **
58+ - The current custom ` CaseInsensitiveDict ` (copied from ` requests.structures ` ) will be replaced by direct imports
59+ from ` requests ` or standard library alternatives.
60+ - Users relying on ` async_tls_client.structures.CaseInsensitiveDict ` should prepare for import path changes.
61+
62+ 3 . ** Standard ` http.cookiejar.CookieJar ` Implementation**
63+ - The custom ` RequestsCookieJar ` (borrowed from ` requests ` ) will be replaced with ` http.cookiejar.CookieJar ` for
64+ cookie management.
65+ - This may impact cookie handling APIs and persistence behavior.
66+
67+ 4 . ** Response Class Refactoring**
68+ - The ` Response ` class may undergo structural changes to simplify implementation and align with modern Python
69+ practices.
70+ - Potential impacts include changes to attribute access, content handling, or JSON parsing methods.
71+
72+ ### Recommendations:
73+
74+ - Monitor changelogs for deprecation warnings in future minor releases
75+ - Avoid direct reliance on internal modules like ` async_tls_client.structures ` or ` async_tls_client.cookies `
76+ - Consider contributing feedback on the proposed changes through GitHub issues
77+
4378## Installation 📦
4479
4580``` bash
@@ -54,6 +89,7 @@ pip install async_tls_client
5489from async_tls_client import AsyncClient
5590import asyncio
5691
92+
5793async def main ():
5894 async with AsyncClient(" chrome120" ) as client:
5995 response = await client.get(
@@ -65,6 +101,7 @@ async def main():
65101 print (f " Headers: { response.headers} " )
66102 print (f " JSON: { response.json()} " )
67103
104+
68105asyncio.run(main())
69106```
70107
@@ -101,17 +138,17 @@ client = AsyncClient(
101138
102139Preconfigured client identifiers (https://github.com/bogdanfinn/tls-client/blob/master/profiles/profiles.go ):
103140
104- | Browser/Framework | Available Profiles |
105- | -------------------------| ------------------------------------------------------------------------------------|
106- | Chrome | chrome_103 - chrome_133 (including PSK variants: 116_PSK, 116_PSK_PQ, 131_PSK, 133_PSK) |
107- | Firefox | firefox_102 - firefox_135 |
108- | Safari (Desktop) | safari_15_6_1, safari_16_0, safari_ipad_15_6 |
109- | Safari (iOS) | safari_ios_15_5 - safari_ios_18_0 |
110- | Opera | opera_89 - opera_91 |
111- | Android (OkHttp) | okhttp4_android_7 - okhttp4_android_13 |
112- | iOS (Custom) | mms_ios (v1, v2, v3), mesh_ios (v1, v2), confirmed_ios, zalando_ios_mobile, nike_ios_mobile |
113- | Android (Custom) | mesh_android (v1, v2), confirmed_android, zalando_android_mobile, nike_android_mobile |
114- | Cloudflare | cloudscraper |
141+ | Browser/Framework | Available Profiles |
142+ | -------------------| --------- ------------------------------------------------------------------------------------|
143+ | Chrome | chrome_103 - chrome_133 (including PSK variants: 116_PSK, 116_PSK_PQ, 131_PSK, 133_PSK) |
144+ | Firefox | firefox_102 - firefox_135 |
145+ | Safari (Desktop) | safari_15_6_1, safari_16_0, safari_ipad_15_6 |
146+ | Safari (iOS) | safari_ios_15_5 - safari_ios_18_0 |
147+ | Opera | opera_89 - opera_91 |
148+ | Android (OkHttp) | okhttp4_android_7 - okhttp4_android_13 |
149+ | iOS (Custom) | mms_ios (v1, v2, v3), mesh_ios (v1, v2), confirmed_ios, zalando_ios_mobile, nike_ios_mobile |
150+ | Android (Custom) | mesh_android (v1, v2), confirmed_android, zalando_android_mobile, nike_android_mobile |
151+ | Cloudflare | cloudscraper |
115152
116153## Advanced Features 🔧
117154
@@ -155,34 +192,37 @@ response = await client.get(
155192The client leverages Python's asyncio through three key strategies:
156193
1571941 . ** Non-blocking I/O**
158- - Network operations run in separate threads using ` asyncio.to_thread `
159- - Go TLS client handles remain managed in background executors
195+ - Network operations run in separate threads using ` asyncio.to_thread `
196+ - Go TLS client handles remain managed in background executors
160197
1611982 . ** Session Management**
162- - ` AsyncClient ` context manager handles automatic cleanup
163- - Connection pooling with automatic keep-alives
164- - Cookie persistence across requests
199+ - ` AsyncClient ` context manager handles automatic cleanup
200+ - Connection pooling with automatic keep-alives
201+ - Cookie persistence across requests
165202
1662033 . ** Resource Optimization**
167- - Zero-copy body handling for large responses
168- - Lazy initialization of heavy resources
169- - Automatic memory cleanup of Go pointers
204+ - Zero-copy body handling for large responses
205+ - Lazy initialization of heavy resources
206+ - Automatic memory cleanup of Go pointers
170207
171208## Packaging 📦
172209
173210When using PyInstaller/PyArmor, include the shared library:
174211
175212### Windows
213+
176214``` bash
177215--add-binary ' async_tls_client/dependencies/tls-client-64.dll;async_tls_client/dependencies'
178216```
179217
180218### Linux
219+
181220``` bash
182221--add-binary ' async_tls_client/dependencies/tls-client-x86.so:async_tls_client/dependencies'
183222```
184223
185224### macOS
225+
186226``` bash
187227--add-binary ' async_tls_client/dependencies/tls-client-arm64.dylib:async_tls_client/dependencies'
188228```
0 commit comments