tls-client-python 1.15.0.2__py3-none-manylinux2014_i686.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,365 @@
1
+ Metadata-Version: 2.4
2
+ Name: tls-client-python
3
+ Version: 1.15.0.2
4
+ Summary: High-performance Python binding for bogdanfinn/tls-client via CFFI – zero-copy, panic-proof, full TLS fingerprint control
5
+ Author: komAAmok
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/komAAmok/tls-client-python
8
+ Project-URL: Documentation, https://github.com/komAAmok/tls-client-python#readme
9
+ Project-URL: Repository, https://github.com/komAAmok/tls-client-python
10
+ Project-URL: Issues, https://github.com/komAAmok/tls-client-python/issues
11
+ Keywords: tls,tls-fingerprint,http-client,ja3,http2,http3,quic,cffi,akamai,cloudflare,anti-bot
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: MacOS :: MacOS X
15
+ Classifier: Operating System :: Microsoft :: Windows
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.6
19
+ Classifier: Programming Language :: Python :: 3.7
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: Implementation :: CPython
26
+ Classifier: Topic :: Internet :: WWW/HTTP
27
+ Classifier: Topic :: Security
28
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
29
+ Requires-Python: <3.13,>=3.6
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: cffi>=1.14.0
33
+ Dynamic: license-file
34
+
35
+ # tls-client-python
36
+
37
+ [![PyPI version](https://img.shields.io/pypi/v/tls-client-python)](https://pypi.org/project/tls-client-python/)
38
+ [![Python](https://img.shields.io/pypi/pyversions/tls-client-python)](https://pypi.org/project/tls-client-python/)
39
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
40
+
41
+ **High-performance Python binding for [bogdanfinn/tls-client](https://github.com/bogdanfinn/tls-client) via CFFI.**
42
+
43
+ Zero-copy FFI boundary, panic-proof, full TLS fingerprint control — with a familiar `requests`-style API.
44
+
45
+ ---
46
+
47
+ ## What is TLS Fingerprinting?
48
+
49
+ Some people think it is enough to change the user-agent header of a request to let the server think that the client
50
+ requesting a resource is a specific browser.
51
+ Nowadays this is not enough, because the server might use a technique to detect the client browser which is called TLS
52
+ Fingerprinting.
53
+
54
+ For a deep dive, see [this excellent article on TLS fingerprinting](https://httptoolkit.tech/blog/tls-fingerprinting-node-js/#how-does-tls-fingerprinting-work).
55
+
56
+ ## ✨ Features
57
+
58
+ | Category | Details |
59
+ |----------|---------|
60
+ | 🔐 **TLS Fingerprinting** | Impersonate Chrome, Firefox, Safari, Brave, Opera, OkHttp & more |
61
+ | 🌐 **Protocol Support** | HTTP/1.1, HTTP/2 (h2), HTTP/3 (QUIC) with automatic negotiation |
62
+ | ⚡ **Protocol Racing** | Chrome-style Happy Eyeballs for HTTP/2 vs HTTP/3 |
63
+ | 📋 **Header Ordering** | Control the exact order of HTTP headers per request |
64
+ | 🔒 **Certificate Pinning** | Pin server certificates for enhanced security |
65
+ | 🍪 **Cookie Jar** | Built-in cookie handling with customisable jar |
66
+ | 🚇 **Proxy Support** | HTTP and SOCKS5 proxies with CONNECT auth |
67
+ | 🔀 **Redirect Control** | Choose whether to follow redirects per request |
68
+ | 📊 **Bandwidth Tracking** | Monitor upload/download bytes in real time |
69
+ | 🔄 **sync/Async** | `Session` + `AsyncSession` |
70
+ | 🛡️ **Panic-proof** | All Go panics caught and surfaced as Python exceptions |
71
+ | ⚙️ **Custom TLS** | Full 26-field custom TLS client configuration |
72
+
73
+ ---
74
+
75
+ ## 📦 Installation
76
+
77
+ ```bash
78
+ pip install tls-client-python
79
+ ```
80
+
81
+ Pre-compiled binaries are included for **9 platforms** — no Go toolchain required.
82
+
83
+ > **Requirements:** Python 3.6+
84
+
85
+ ---
86
+
87
+ ## 🚀 Quick Start
88
+
89
+ ```python
90
+ from tls_client import Session
91
+
92
+ # Create a session with Chrome 146 fingerprint
93
+ session = Session(client_identifier="chrome_146", verify=False)
94
+
95
+ # GET request
96
+ resp = session.get("https://tls.browserleaks.com/json")
97
+ print(resp.status_code)
98
+ print(resp.text)
99
+
100
+ # POST request
101
+ resp = session.post("https://tools.scrapfly.io/api/fp/ja3")
102
+ data = resp.json()
103
+ print(resp.status_code)
104
+ print(data)
105
+
106
+
107
+ # Context Manager
108
+ with Session(client_identifier="firefox_148") as session:
109
+ resp = session.get("https://tls.browserleaks.com/json")
110
+ print(resp.status_code)
111
+ print(resp.text)
112
+
113
+
114
+ # Async Usage
115
+ import asyncio
116
+ from tls_client import AsyncSession
117
+
118
+ async def main():
119
+ async with AsyncSession(client_identifier="firefox_148") as s:
120
+ resp = await s.get("https://tls.browserleaks.com/json")
121
+ print(resp.status_code)
122
+ print(resp.json())
123
+
124
+ asyncio.run(main())
125
+ ```
126
+
127
+ ---
128
+
129
+ ## 🖥️ Supported Platforms
130
+
131
+ Pre-compiled native libraries are bundled for these platforms:
132
+
133
+ | OS | Architecture | Binary |
134
+ |----|-------------|--------|
135
+ | **Windows** | x86-64 | `tls-client-windows-amd64.dll` |
136
+ | **Windows** | x86 (32-bit) | `tls-client-windows-386.dll` |
137
+ | **macOS** | x86-64 | `tls-client-darwin-amd64.dylib` |
138
+ | **macOS** | ARM64 (Apple Silicon) | `tls-client-darwin-arm64.dylib` |
139
+ | **Linux** | x86-64 (glibc) | `tls-client-linux-amd64.so` |
140
+ | **Linux** | x86 (32-bit, glibc) | `tls-client-linux-386.so` |
141
+ | **Linux** | ARM64 | `tls-client-linux-arm64.so` |
142
+ | **Linux** | ARMv7 | `tls-client-linux-arm.so` |
143
+ | **Alpine Linux** | x86-64 (musl) | `tls-client-alpine-amd64.so` |
144
+
145
+ The correct binary is automatically selected at runtime. Override via `TLS_CLIENT_LIB` environment variable.
146
+
147
+ ---
148
+
149
+ ## 🎭 Supported Browser Profiles — 79 Identifiers
150
+
151
+ ### 🌐 Chrome — 24 Profiles
152
+
153
+ | Identifier | Notes |
154
+ |-----------|-------|
155
+ | `chrome_103` — `chrome_112` | Chrome Stable 103–112 |
156
+ | `chrome_116_PSK` | Chrome 116 with PSK key exchange |
157
+ | `chrome_116_PSK_PQ` | Chrome 116 with PSK + Post-Quantum |
158
+ | `chrome_117` | Chrome 117 |
159
+ | `chrome_120` | Chrome 120 |
160
+ | `chrome_124` | Chrome 124 |
161
+ | `chrome_130_PSK` | Chrome 130 with PSK |
162
+ | `chrome_131` · `chrome_131_PSK` | Chrome 131 (standard & PSK) |
163
+ | `chrome_133` · `chrome_133_PSK` | Chrome 133 (standard & PSK) |
164
+ | `chrome_144` · `chrome_144_PSK` | Chrome 144 (standard & PSK) |
165
+ | `chrome_146` · `chrome_146_PSK` | Chrome 146 — **default** (standard & PSK) |
166
+
167
+ ### 🦊 Firefox — 16 Profiles
168
+
169
+ | Identifier | Notes |
170
+ |-----------|-------|
171
+ | `firefox_102` · `firefox_104` · `firefox_105` · `firefox_106` | Firefox 102–106 |
172
+ | `firefox_108` · `firefox_110` | Firefox 108 · 110 |
173
+ | `firefox_117` · `firefox_120` · `firefox_123` | Firefox 117–123 |
174
+ | `firefox_132` · `firefox_133` · `firefox_135` | Firefox 132–135 |
175
+ | `firefox_146_PSK` | Firefox 146 with PSK |
176
+ | `firefox_147` · `firefox_147_PSK` | Firefox 147 (standard & PSK) |
177
+ | `firefox_148` | Firefox 148 |
178
+
179
+ ### 🍏 Safari — 10 Profiles
180
+
181
+ | Identifier | Device |
182
+ |-----------|--------|
183
+ | `safari_15_6_1` | Safari 15.6.1 (macOS) |
184
+ | `safari_16_0` | Safari 16.0 (macOS) |
185
+ | `safari_ipad_15_6` | Safari 15.6 (iPadOS) |
186
+ | `safari_ios_15_5` · `safari_ios_15_6` | Safari iOS 15.5–15.6 |
187
+ | `safari_ios_16_0` · `safari_ios_17_0` | Safari iOS 16 · 17 |
188
+ | `safari_ios_18_0` · `safari_ios_18_5` | Safari iOS 18 · 18.5 |
189
+ | `safari_ios_26_0` | Safari iOS 26 |
190
+
191
+ ### 🦁 Brave — 2 Profiles
192
+
193
+ | Identifier | Notes |
194
+ |-----------|-------|
195
+ | `brave_146` | Brave Browser 146 |
196
+ | `brave_146_PSK` | Brave 146 with PSK |
197
+
198
+ ### 🎭 Opera — 3 Profiles
199
+
200
+ | Identifier |
201
+ |-----------|
202
+ | `opera_89` · `opera_90` · `opera_91` |
203
+
204
+ ### 🤖 OkHttp (Android) — 7 Profiles
205
+
206
+ | Identifier |
207
+ |-----------|
208
+ | `okhttp4_android_7` — `okhttp4_android_13` |
209
+
210
+ ### 📱 Mobile / App SDKs — 16 Profiles
211
+
212
+ | Category | Identifiers |
213
+ |----------|------------|
214
+ | Zalando | `zalando_android_mobile` · `zalando_ios_mobile` |
215
+ | Nike | `nike_ios_mobile` · `nike_android_mobile` |
216
+ | MMS | `mms_ios` · `mms_ios_1` · `mms_ios_2` · `mms_ios_3` |
217
+ | Mesh | `mesh_ios` · `mesh_ios_1` · `mesh_ios_2` · `mesh_android` · `mesh_android_1` · `mesh_android_2` |
218
+ | Confirmed | `confirmed_ios` · `confirmed_android` |
219
+
220
+ ### ☁️ Cloudflare-specific — 1 Profile
221
+
222
+ | Identifier | Notes |
223
+ |-----------|-------|
224
+ | `cloudscraper` | Custom profile tuned for Cloudflare-protected sites |
225
+
226
+ ---
227
+
228
+ ## 🔧 Advanced Usage
229
+
230
+ ### Custom TLS Client (Full Control)
231
+
232
+ Set `custom_tls_client` with up to 26 fields to bypass `client_identifier` entirely:
233
+
234
+ ```python
235
+ session = Session(custom_tls_client={
236
+ "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",
237
+ "h2_settings": {"HEADER_TABLE_SIZE": 65536, "MAX_CONCURRENT_STREAMS": 1000},
238
+ "h2_settings_order": ["HEADER_TABLE_SIZE", "MAX_CONCURRENT_STREAMS"],
239
+ "pseudo_header_order": [":method", ":authority", ":scheme", ":path"],
240
+ "connection_flow": 1048576,
241
+ "key_share_curves": ["X25519", "P256"],
242
+ "alpn_protocols": ["h2", "http/1.1"],
243
+ "supported_versions": ["1.3", "1.2"],
244
+ "stream_id": 3,
245
+ })
246
+ ```
247
+
248
+ ### Certificate Pinning
249
+
250
+ ```python
251
+ session = Session(
252
+ certificate_pinning_hosts={
253
+ "example.com": ["sha256/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="]
254
+ }
255
+ )
256
+ ```
257
+
258
+ ### Client Certificates (mTLS)
259
+
260
+ ```python
261
+ session = Session(
262
+ client_certificates=[{
263
+ "cert_pem": open("client.crt", "rb").read(),
264
+ "key_pem": open("client.key", "rb").read(),
265
+ }]
266
+ )
267
+ ```
268
+
269
+ ### Stream Response to Disk
270
+
271
+ ```python
272
+ resp = session.stream_to_file(
273
+ "GET", "https://tls.browserleaks.com/",
274
+ output_path="/tmp/image.png"
275
+ )
276
+ print(resp.status_code) # response metadata still available
277
+ ```
278
+
279
+ ### Per-Request Overrides
280
+
281
+ All `Session` constructor parameters can be overridden per request:
282
+
283
+ ```python
284
+ s = Session(client_identifier="chrome_146")
285
+ # Override fingerprint for a single request
286
+ resp = s.get("https://tls.browserleaks.com/json", client_identifier="firefox_148")
287
+ ```
288
+
289
+ ---
290
+
291
+ ## 🔬 Architecture
292
+
293
+ | Layer | Technology |
294
+ |-------|-----------|
295
+ | **Go Engine** | `bogdanfinn/tls-client` compiled as C shared library (`-buildmode=c-shared`) |
296
+ | **FFI Boundary** | Raw C structs via CFFI — no JSON serialization overhead |
297
+ | **Memory Safety** | `ffi.gc(resp, FreeResponse)` — Go panics surfaced as `RuntimeError` |
298
+ | **Python API** | `requests`-style `Session`, `Response`, `AsyncSession` |
299
+
300
+ ---
301
+
302
+ ## 📚 API Reference
303
+
304
+ ### Session
305
+
306
+ | Method | Description |
307
+ |--------|-------------|
308
+ | `get(url, **kwargs)` | HTTP GET |
309
+ | `post(url, **kwargs)` | HTTP POST |
310
+ | `put(url, **kwargs)` | HTTP PUT |
311
+ | `delete(url, **kwargs)` | HTTP DELETE |
312
+ | `head(url, **kwargs)` | HTTP HEAD |
313
+ | `patch(url, **kwargs)` | HTTP PATCH |
314
+ | `execute_request(method, url, **kwargs)` | Generic request with full options |
315
+ | `typed_request(Request)` | Strongly-typed request |
316
+ | `stream_to_file(method, url, path)` | Stream response body to disk |
317
+ | `clear_client_pool()` | Close idle connections (static) |
318
+
319
+ ### Response
320
+
321
+ | Property / Method | Description |
322
+ |-------------------|-------------|
323
+ | `status_code` | HTTP status code (int) |
324
+ | `headers` | Response headers (dict of list) |
325
+ | `content` | Raw bytes body |
326
+ | `text` | Decoded text body |
327
+ | `encoding` | Detected charset |
328
+ | `url` | Final URL after redirects |
329
+ | `cookies` | Response cookies dict |
330
+ | `used_protocol` | Protocol used (e.g. `HTTP/2.0`) |
331
+ | `ok` | `True` if `status_code < 400` |
332
+ | `reason` | HTTP reason phrase |
333
+ | `json()` | Parse body as JSON |
334
+ | `raise_for_status()` | Raise `RuntimeError` on 4xx/5xx |
335
+
336
+ ---
337
+
338
+ ## 🔗 Credits
339
+
340
+ This project is a Python binding for **[bogdanfinn/tls-client](https://github.com/bogdanfinn/tls-client)**, which itself is built upon:
341
+
342
+ - [Carcraftz/fhttp](https://github.com/Carcraftz/fhttp)
343
+ - [Carcraftz/utls](https://github.com/Carcraftz/utls)
344
+ - [refraction-networking/utls](https://github.com/refraction-networking/utls)
345
+
346
+ ---
347
+
348
+ ## 📄 License
349
+
350
+ MIT — see [LICENSE](LICENSE).
351
+
352
+ ---
353
+
354
+ ## 🙏 Community
355
+
356
+ Join the [Discord server](https://discord.gg/7Ej9eJvHqk) for support and discussion.
357
+
358
+ ---
359
+
360
+ <p align="center">
361
+ <em>Powered by</em><br>
362
+ <a href="https://jb.gg/OpenSource">
363
+ <img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg" alt="JetBrains logo." height="40">
364
+ </a>
365
+ </p>
@@ -0,0 +1,18 @@
1
+ tls_client/__init__.py,sha256=CpSzdSGbmihq0O4lin_NS5JWZ57CgjEIfT7vkf7Wlak,673
2
+ tls_client/_core.py,sha256=-mTvR3-mas8vvXSofGkF22qHtS5p2E5hysDbznxKNlY,125699
3
+ tls_client/_default_headers.py,sha256=WFxTVRs5JEdq4IYwUud8husnFRKOMfuDNQFbQzQ1AG0,20830
4
+ tls_client/bin/tls-client-alpine-amd64.so,sha256=bgK9T3QPkxxAlfuyZ6TGVgt5WHtiEvd3v_M6ztv3o6I,12018864
5
+ tls_client/bin/tls-client-darwin-amd64.dylib,sha256=g8gtTktXPgwkxBrkpL1JXmTHdHa6NA77tkdBieOg82E,10856368
6
+ tls_client/bin/tls-client-darwin-arm64.dylib,sha256=XWh9DzZuFcME5pfd2VW0eZfBhmw3WjxKzPH6bvY6i9o,10296784
7
+ tls_client/bin/tls-client-linux-386.so,sha256=Or1bN4qOEC1MbArLs66CiCeck5QSp_gpyLuSGxSs15U,11083608
8
+ tls_client/bin/tls-client-linux-amd64.so,sha256=WW1uTeEj_Mc1JXuZ-SAOcJ3DGdr5yruzaCOz0r7Q2wU,12019024
9
+ tls_client/bin/tls-client-linux-arm.so,sha256=f34GuOutnGkmhUfS2yQ9l-Es4x0HkQ-Ej5pPQ2gBGGo,11049280
10
+ tls_client/bin/tls-client-linux-arm64.so,sha256=n4kwdTIVmMbkge219Ygh_r4oKcf589LnEsqmc15x9ds,11421304
11
+ tls_client/bin/tls-client-windows-386.dll,sha256=NrmVkJ7blDwW8H1VIytBeu9Qltzqku3tvIej5Avpv_c,10612224
12
+ tls_client/bin/tls-client-windows-amd64.dll,sha256=FqMLr8jzf3AUUMoZVwsnMFVPameYBqLc5IAMz2J6cKc,11079168
13
+ tls_client/bin/tls-client.so,sha256=LweA5hxSG8CnwKvhag0MQojwN6LeI_9f901YS4neWu0,11083516
14
+ tls_client_python-1.15.0.2.dist-info/licenses/LICENSE,sha256=fauaTdZph_vldtU8HuBHwZNyXfb0-sZ94xWhJ0F_0VE,1662
15
+ tls_client_python-1.15.0.2.dist-info/METADATA,sha256=anFH5sVTxAvmAx3QB7E6qS_SvVTQ5xHoc2CH0WgfRow,12286
16
+ tls_client_python-1.15.0.2.dist-info/WHEEL,sha256=PzRPF_fTIINojrBq-V6k3IGjMI0K2T8TGbGBgyOsL0Q,106
17
+ tls_client_python-1.15.0.2.dist-info/top_level.txt,sha256=yLrfQtbTRfECzPN62knWdGNmbhcPRev1grCAMuEsEz0,11
18
+ tls_client_python-1.15.0.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-manylinux2014_i686
5
+
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2023, Bogdan Finn
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+ 1. Redistributions of source code must retain the above copyright
7
+ notice, this list of conditions and the following disclaimer.
8
+ 2. Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+ 3. All advertising materials mentioning features or use of this software
12
+ must display the following acknowledgement:
13
+ This product includes software developed by the <organization>.
14
+ 4. Neither the name of the <organization> nor the
15
+ names of its contributors may be used to endorse or promote products
16
+ derived from this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ''AS IS'' AND ANY
19
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
27
+ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1 @@
1
+ tls_client