tls-client-python 1.15.0.1__tar.gz → 1.15.0.2__tar.gz
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.
- {tls_client_python-1.15.0.1/tls_client_python.egg-info → tls_client_python-1.15.0.2}/PKG-INFO +2 -3
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/pyproject.toml +1 -2
- tls_client_python-1.15.0.2/setup.py +12 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/__init__.py +1 -16
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/_core.py +23 -111
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/bin/tls-client-linux-386.so +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/bin/tls-client-windows-386.dll +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/bin/tls-client-windows-amd64.dll +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2/tls_client_python.egg-info}/PKG-INFO +2 -3
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client_python.egg-info/SOURCES.txt +1 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/LICENSE +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/MANIFEST.in +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/Readme.md +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/setup.cfg +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/_default_headers.py +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/bin/tls-client-alpine-amd64.so +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/bin/tls-client-darwin-amd64.dylib +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/bin/tls-client-darwin-arm64.dylib +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/bin/tls-client-linux-amd64.so +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/bin/tls-client-linux-arm.so +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/bin/tls-client-linux-arm64.so +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client_python.egg-info/dependency_links.txt +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client_python.egg-info/not-zip-safe +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client_python.egg-info/requires.txt +0 -0
- {tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client_python.egg-info/top_level.txt +0 -0
{tls_client_python-1.15.0.1/tls_client_python.egg-info → tls_client_python-1.15.0.2}/PKG-INFO
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tls-client-python
|
|
3
|
-
Version: 1.15.0.
|
|
3
|
+
Version: 1.15.0.2
|
|
4
4
|
Summary: High-performance Python binding for bogdanfinn/tls-client via CFFI – zero-copy, panic-proof, full TLS fingerprint control
|
|
5
5
|
Author: komAAmok
|
|
6
|
-
License: MIT
|
|
6
|
+
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/komAAmok/tls-client-python
|
|
8
8
|
Project-URL: Documentation, https://github.com/komAAmok/tls-client-python#readme
|
|
9
9
|
Project-URL: Repository, https://github.com/komAAmok/tls-client-python
|
|
@@ -11,7 +11,6 @@ Project-URL: Issues, https://github.com/komAAmok/tls-client-python/issues
|
|
|
11
11
|
Keywords: tls,tls-fingerprint,http-client,ja3,http2,http3,quic,cffi,akamai,cloudflare,anti-bot
|
|
12
12
|
Classifier: Development Status :: 4 - Beta
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
15
14
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
16
15
|
Classifier: Operating System :: Microsoft :: Windows
|
|
17
16
|
Classifier: Operating System :: POSIX :: Linux
|
|
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
|
|
|
6
6
|
name = "tls-client-python"
|
|
7
7
|
description = "High-performance Python binding for bogdanfinn/tls-client via CFFI – zero-copy, panic-proof, full TLS fingerprint control"
|
|
8
8
|
readme = { file = "Readme.md", content-type = "text/markdown" }
|
|
9
|
-
license =
|
|
9
|
+
license = "MIT"
|
|
10
10
|
authors = [
|
|
11
11
|
{ name = "komAAmok" }
|
|
12
12
|
]
|
|
@@ -26,7 +26,6 @@ keywords = [
|
|
|
26
26
|
classifiers = [
|
|
27
27
|
"Development Status :: 4 - Beta",
|
|
28
28
|
"Intended Audience :: Developers",
|
|
29
|
-
"License :: OSI Approved :: MIT License",
|
|
30
29
|
"Operating System :: MacOS :: MacOS X",
|
|
31
30
|
"Operating System :: Microsoft :: Windows",
|
|
32
31
|
"Operating System :: POSIX :: Linux",
|
|
@@ -6,19 +6,6 @@ The package auto‑detects the host OS and architecture at import time,
|
|
|
6
6
|
selecting the correct pre‑compiled binary from the bundled ``bin/``
|
|
7
7
|
directory. A ``TLS_CLIENT_LIB`` environment variable may be used to
|
|
8
8
|
override automatic discovery.
|
|
9
|
-
|
|
10
|
-
Quick start
|
|
11
|
-
-----------
|
|
12
|
-
>>> from tls_client import Session
|
|
13
|
-
>>> s = Session(client_identifier="chrome_146")
|
|
14
|
-
>>> resp = s.get("https://httpbin.org/json")
|
|
15
|
-
>>> print(resp.status_code, resp.text[:50])
|
|
16
|
-
|
|
17
|
-
Async
|
|
18
|
-
-----
|
|
19
|
-
>>> from tls_client import AsyncSession
|
|
20
|
-
>>> async with AsyncSession() as s:
|
|
21
|
-
... resp = await s.get("https://httpbin.org/json")
|
|
22
9
|
"""
|
|
23
10
|
|
|
24
11
|
from tls_client._core import (
|
|
@@ -27,7 +14,6 @@ from tls_client._core import (
|
|
|
27
14
|
Request,
|
|
28
15
|
Response,
|
|
29
16
|
ClientIdentifiers,
|
|
30
|
-
ClientIdentifiers,
|
|
31
17
|
clear_client_pool,
|
|
32
18
|
)
|
|
33
19
|
|
|
@@ -37,7 +23,6 @@ __all__ = [
|
|
|
37
23
|
"Request",
|
|
38
24
|
"Response",
|
|
39
25
|
"ClientIdentifiers",
|
|
40
|
-
"ClientIdentifiers",
|
|
41
26
|
"clear_client_pool",
|
|
42
27
|
]
|
|
43
|
-
__version__ = "1.15.0.
|
|
28
|
+
__version__ = "1.15.0.2"
|
|
@@ -654,86 +654,17 @@ int RequestAsync(RequestOptions* opts, uintptr_t request_id, async_ca
|
|
|
654
654
|
# Platform detection & shared‑library loading
|
|
655
655
|
# ---------------------------------------------------------------------------
|
|
656
656
|
|
|
657
|
-
def _detect_libc() -> str:
|
|
658
|
-
"""Detect the C library flavour on Linux. Returns ``"glibc"``, ``"musl"``, or ``"unknown"``.
|
|
659
|
-
|
|
660
|
-
This is important because a shared library compiled against glibc
|
|
661
|
-
will not load on a musl-based distribution (Alpine, Void musl, etc.)
|
|
662
|
-
and vice versa.
|
|
663
|
-
"""
|
|
664
|
-
if sys.platform != "linux":
|
|
665
|
-
return "glibc" # non‑Linux → irrelevant
|
|
666
|
-
try:
|
|
667
|
-
# musl defines a weak symbol __musl__ that glibc does not.
|
|
668
|
-
libc = ctypes.CDLL(None) # the process itself
|
|
669
|
-
try:
|
|
670
|
-
libc.__musl__ # pylint: disable=pointless-statement
|
|
671
|
-
return "musl"
|
|
672
|
-
except AttributeError:
|
|
673
|
-
return "glibc"
|
|
674
|
-
except Exception:
|
|
675
|
-
# Fallback: check for /lib/ld-musl-*.so*
|
|
676
|
-
for entry in Path("/lib").glob("ld-musl-*"):
|
|
677
|
-
if entry.is_file():
|
|
678
|
-
return "musl"
|
|
679
|
-
return "unknown"
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
def _libc_suffix() -> str:
|
|
683
|
-
"""Return an optional libc suffix for the library filename.
|
|
684
|
-
|
|
685
|
-
Alpine (musl) binaries carry a ``-musl`` suffix so they don't collide
|
|
686
|
-
with glibc builds on PyPI.
|
|
687
|
-
"""
|
|
688
|
-
if sys.platform == "linux" and _detect_libc() == "musl":
|
|
689
|
-
return "-musl"
|
|
690
|
-
return ""
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
def _go_os() -> str:
|
|
694
|
-
return {"darwin": "darwin", "linux": "linux", "win32": "windows"}.get(
|
|
695
|
-
sys.platform, sys.platform
|
|
696
|
-
)
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
def _go_arch() -> str:
|
|
700
|
-
m = platform.machine().lower()
|
|
701
|
-
return {
|
|
702
|
-
"x86_64": "amd64", "amd64": "amd64",
|
|
703
|
-
"arm64": "arm64", "aarch64": "arm64",
|
|
704
|
-
"armv7l": "arm", "armv6l": "arm",
|
|
705
|
-
"i386": "386", "i686": "386",
|
|
706
|
-
}.get(m, m)
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
def _shared_lib_ext() -> str:
|
|
710
|
-
if sys.platform == "darwin":
|
|
711
|
-
return ".dylib"
|
|
712
|
-
elif sys.platform == "win32":
|
|
713
|
-
return ".dll"
|
|
714
|
-
return ".so"
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
def _shared_lib_name() -> str:
|
|
718
|
-
ext = _shared_lib_ext()
|
|
719
|
-
goos = _go_os()
|
|
720
|
-
goarch = _go_arch()
|
|
721
|
-
lc = _libc_suffix()
|
|
722
|
-
return f"tls-client-{goos}-{goarch}{lc}{ext}"
|
|
723
|
-
|
|
724
|
-
|
|
725
657
|
def _find_library() -> str:
|
|
726
|
-
"""
|
|
658
|
+
"""定位平台对应的动态链接库。
|
|
727
659
|
|
|
728
|
-
|
|
729
|
-
1. ``TLS_CLIENT_LIB``
|
|
730
|
-
2.
|
|
731
|
-
3.
|
|
660
|
+
搜索顺序:
|
|
661
|
+
1. 读取 ``TLS_CLIENT_LIB`` 环境变量(显式用户覆盖)。
|
|
662
|
+
2. 寻找包目录内 ``tls_client/bin/`` 下的平台专属统一命名文件。
|
|
663
|
+
3. 寻找同级开发目录 ``dist/`` 下的文件。
|
|
732
664
|
|
|
733
|
-
|
|
734
|
-
no binary is found, including hints for Alpine/musl users.
|
|
665
|
+
若未找到任何匹配文件,抛出 :exc:`FileNotFoundError`。
|
|
735
666
|
"""
|
|
736
|
-
# 1.
|
|
667
|
+
# 1. 环境变量显式覆盖
|
|
737
668
|
env_lib = os.environ.get("TLS_CLIENT_LIB")
|
|
738
669
|
if env_lib:
|
|
739
670
|
p = Path(env_lib)
|
|
@@ -743,56 +674,37 @@ def _find_library() -> str:
|
|
|
743
674
|
f"TLS_CLIENT_LIB is set to '{env_lib}' but the file does not exist."
|
|
744
675
|
)
|
|
745
676
|
|
|
746
|
-
|
|
677
|
+
# 2. 根据系统平台直接映射标准统一文件名
|
|
678
|
+
if sys.platform == "win32":
|
|
679
|
+
name = "tls-client.dll"
|
|
680
|
+
elif sys.platform == "darwin":
|
|
681
|
+
name = "tls-client.dylib"
|
|
682
|
+
else:
|
|
683
|
+
name = "tls-client.so"
|
|
684
|
+
|
|
747
685
|
here = Path(__file__).resolve().parent
|
|
748
686
|
|
|
749
|
-
#
|
|
687
|
+
# 3. 寻找分平台 Wheel 安装后的专属内置路径
|
|
750
688
|
bundled = here / "bin" / name
|
|
751
689
|
if bundled.exists():
|
|
752
690
|
return str(bundled)
|
|
753
691
|
|
|
754
|
-
#
|
|
692
|
+
# 4. 本地开发调试路径
|
|
755
693
|
dev = here / "dist" / name
|
|
756
694
|
if dev.exists():
|
|
757
695
|
return str(dev)
|
|
758
696
|
|
|
759
|
-
#
|
|
697
|
+
# 详细的异常诊断提示
|
|
760
698
|
parts = [
|
|
761
|
-
f"Cannot locate shared library '{name}'.",
|
|
699
|
+
f"Cannot locate shared library '{name}' inside the package.",
|
|
762
700
|
"",
|
|
763
701
|
f" Searched: {bundled}",
|
|
764
702
|
f" {dev}",
|
|
703
|
+
"",
|
|
704
|
+
" If you are developing locally, ensure the shared library is compiled and placed",
|
|
705
|
+
" in either 'tls_client/bin/' or 'tls_client/dist/'.",
|
|
706
|
+
" Alternatively, set the 'TLS_CLIENT_LIB' environment variable to point directly to your binary."
|
|
765
707
|
]
|
|
766
|
-
|
|
767
|
-
if sys.platform == "linux":
|
|
768
|
-
libc = _detect_libc()
|
|
769
|
-
parts.append(f" Detected libc: {libc}")
|
|
770
|
-
if libc == "musl":
|
|
771
|
-
parts.append(
|
|
772
|
-
" This is an Alpine / musl-based system. The pre-compiled glibc"
|
|
773
|
-
)
|
|
774
|
-
parts.append(
|
|
775
|
-
" binary cannot be used. Build a musl-compatible library via:"
|
|
776
|
-
)
|
|
777
|
-
parts.append(
|
|
778
|
-
" cd cffi_binding && CGO_ENABLED=1 GOOS=linux GOARCH="
|
|
779
|
-
+ _go_arch()
|
|
780
|
-
+ " go build -buildmode=c-shared -o tls-client-linux-"
|
|
781
|
-
+ _go_arch()
|
|
782
|
-
+ "-musl.so ."
|
|
783
|
-
)
|
|
784
|
-
else:
|
|
785
|
-
parts.append(
|
|
786
|
-
" Make sure the platform matches. Expected: "
|
|
787
|
-
+ _go_os()
|
|
788
|
-
+ "/"
|
|
789
|
-
+ _go_arch()
|
|
790
|
-
)
|
|
791
|
-
|
|
792
|
-
parts.append(
|
|
793
|
-
" Set the TLS_CLIENT_LIB environment variable to point to the correct binary."
|
|
794
|
-
)
|
|
795
|
-
|
|
796
708
|
raise FileNotFoundError("\n".join(parts))
|
|
797
709
|
|
|
798
710
|
|
{tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/bin/tls-client-linux-386.so
RENAMED
|
Binary file
|
{tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/bin/tls-client-windows-386.dll
RENAMED
|
Binary file
|
|
Binary file
|
{tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2/tls_client_python.egg-info}/PKG-INFO
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tls-client-python
|
|
3
|
-
Version: 1.15.0.
|
|
3
|
+
Version: 1.15.0.2
|
|
4
4
|
Summary: High-performance Python binding for bogdanfinn/tls-client via CFFI – zero-copy, panic-proof, full TLS fingerprint control
|
|
5
5
|
Author: komAAmok
|
|
6
|
-
License: MIT
|
|
6
|
+
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/komAAmok/tls-client-python
|
|
8
8
|
Project-URL: Documentation, https://github.com/komAAmok/tls-client-python#readme
|
|
9
9
|
Project-URL: Repository, https://github.com/komAAmok/tls-client-python
|
|
@@ -11,7 +11,6 @@ Project-URL: Issues, https://github.com/komAAmok/tls-client-python/issues
|
|
|
11
11
|
Keywords: tls,tls-fingerprint,http-client,ja3,http2,http3,quic,cffi,akamai,cloudflare,anti-bot
|
|
12
12
|
Classifier: Development Status :: 4 - Beta
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
15
14
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
16
15
|
Classifier: Operating System :: Microsoft :: Windows
|
|
17
16
|
Classifier: Operating System :: POSIX :: Linux
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/bin/tls-client-alpine-amd64.so
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/bin/tls-client-linux-amd64.so
RENAMED
|
File without changes
|
{tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/bin/tls-client-linux-arm.so
RENAMED
|
File without changes
|
{tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client/bin/tls-client-linux-arm64.so
RENAMED
|
File without changes
|
|
File without changes
|
{tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client_python.egg-info/not-zip-safe
RENAMED
|
File without changes
|
{tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client_python.egg-info/requires.txt
RENAMED
|
File without changes
|
{tls_client_python-1.15.0.1 → tls_client_python-1.15.0.2}/tls_client_python.egg-info/top_level.txt
RENAMED
|
File without changes
|