notify-tls-client 0.1.6__py3-none-any.whl → 0.1.9__py3-none-any.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.
Files changed (26) hide show
  1. notify_tls_client/__init__.py +2 -2
  2. notify_tls_client/core/client/__init__.py +1 -6
  3. notify_tls_client/core/client/decorators.py +239 -90
  4. notify_tls_client/core/client_identifiers_manager.py +45 -0
  5. notify_tls_client/core/notifytlsclient.py +196 -146
  6. notify_tls_client/core/proxiesmanager/__init__.py +1 -1
  7. notify_tls_client/core/proxiesmanager/proxiesmanager.py +67 -67
  8. notify_tls_client/core/proxiesmanager/proxiesmanagerloader.py +33 -33
  9. notify_tls_client/tls_client/__init__.py +14 -14
  10. notify_tls_client/tls_client/__version__.py +10 -10
  11. notify_tls_client/tls_client/cffi.py +38 -62
  12. notify_tls_client/tls_client/cookies.py +456 -456
  13. notify_tls_client/tls_client/dependencies/{tls-client-xgo-1.11.0-darwin-arm64.dylib → tls-client-darwin-amd64-1.12.0.dylib} +0 -0
  14. notify_tls_client/tls_client/dependencies/tls-client-linux-arm64-1.12.0.so +0 -0
  15. notify_tls_client/tls_client/dependencies/{tls-client-xgo-1.11.0-linux-amd64.so → tls-client-linux-ubuntu-amd64-1.12.0.so} +0 -0
  16. notify_tls_client/tls_client/dependencies/{tls-client-windows-1.11.0-64.dll → tls-client-windows-64-1.12.0.dll} +0 -0
  17. notify_tls_client/tls_client/exceptions.py +2 -2
  18. notify_tls_client/tls_client/response.py +83 -78
  19. notify_tls_client/tls_client/sessions.py +522 -513
  20. notify_tls_client/tls_client/settings.py +69 -69
  21. notify_tls_client/tls_client/structures.py +74 -74
  22. {notify_tls_client-0.1.6.dist-info → notify_tls_client-0.1.9.dist-info}/METADATA +14 -16
  23. notify_tls_client-0.1.9.dist-info/RECORD +27 -0
  24. notify_tls_client-0.1.6.dist-info/RECORD +0 -25
  25. {notify_tls_client-0.1.6.dist-info → notify_tls_client-0.1.9.dist-info}/WHEEL +0 -0
  26. {notify_tls_client-0.1.6.dist-info → notify_tls_client-0.1.9.dist-info}/top_level.txt +0 -0
@@ -1,62 +1,38 @@
1
- import sys
2
- from sys import platform
3
- from platform import machine
4
- import ctypes
5
- import os
6
-
7
- system = sys.platform
8
- arch = machine()
9
-
10
-
11
- if system == "darwin":
12
- # macOS (arm64 = Apple Silicon, x86_64 = Intel)
13
- file_ext = "-arm64.dylib" if arch == "arm64" else "-amd64.dylib"
14
-
15
- elif system in ("win32", "cygwin"):
16
- # Windows (32 ou 64 bits)
17
- file_ext = "-amd64.dll" if ctypes.sizeof(ctypes.c_voidp) == 8 else "-386.dll"
18
-
19
- else:
20
- # Linux e outras
21
- if arch == "aarch64":
22
- file_ext = "-arm64.so"
23
- elif arch == "armv7l":
24
- file_ext = "-arm-7.so"
25
- elif arch == "armv6l":
26
- file_ext = "-arm-6.so"
27
- elif arch == "armv5tel":
28
- file_ext = "-arm-5.so"
29
- elif arch in ("i386", "i686"):
30
- file_ext = "-386.so"
31
- elif arch == "x86_64":
32
- file_ext = "-amd64.so"
33
- else:
34
- raise RuntimeError(f"Arquitetura desconhecida: {arch}")
35
-
36
- root_dir = os.path.abspath(os.path.dirname(__file__))
37
- lib_dir = os.path.join(root_dir, "dependencies")
38
- lib_path = None
39
- # Encontre o primeiro arquivo que termina com o file_ext
40
- for filename in os.listdir(lib_dir):
41
- if filename.endswith(file_ext):
42
- lib_path = os.path.join(lib_dir, filename)
43
- break
44
-
45
- if not lib_path:
46
- raise FileNotFoundError(f"No shared library found in {lib_dir} with extension {file_ext}")
47
-
48
- root_dir = os.path.abspath(os.path.dirname(__file__))
49
- library = ctypes.cdll.LoadLibrary(lib_path)
50
-
51
- # extract the exposed request function from the shared package
52
- request = library.request
53
- request.argtypes = [ctypes.c_char_p]
54
- request.restype = ctypes.c_char_p
55
-
56
- freeMemory = library.freeMemory
57
- freeMemory.argtypes = [ctypes.c_char_p]
58
- freeMemory.restype = ctypes.c_char_p
59
-
60
- destroySession = library.destroySession
61
- destroySession.argtypes = [ctypes.c_char_p]
62
- destroySession.restype = ctypes.c_char_p
1
+ from glob import glob
2
+ from sys import platform
3
+ from platform import machine
4
+ import ctypes
5
+ import os
6
+
7
+
8
+ if platform == 'darwin':
9
+ file_ext = '-arm64-*.dylib' if machine() == "arm64" else '-x86-*.dylib'
10
+ elif platform in ('win32', 'cygwin'):
11
+ file_ext = '*-64-*.dll' if 8 == ctypes.sizeof(ctypes.c_voidp) else '*-32-*.dll'
12
+ else:
13
+ if machine() == "aarch64":
14
+ file_ext = '-arm64-*.so'
15
+ elif "x86" in machine():
16
+ file_ext = '-x86-*.so'
17
+ else:
18
+ file_ext = '-amd64-*.so'
19
+
20
+ root_dir = os.path.abspath(os.path.dirname(__file__))
21
+ matches = glob(f'{root_dir}/dependencies/tls-client{file_ext}')
22
+ if not matches:
23
+ raise FileNotFoundError(f'No tls-client library found for the current platform: {platform} {machine()}')
24
+
25
+ library = ctypes.cdll.LoadLibrary(matches[0])
26
+
27
+ # extract the exposed request function from the shared package
28
+ request = library.request
29
+ request.argtypes = [ctypes.c_char_p]
30
+ request.restype = ctypes.c_char_p
31
+
32
+ freeMemory = library.freeMemory
33
+ freeMemory.argtypes = [ctypes.c_char_p]
34
+ freeMemory.restype = ctypes.c_char_p
35
+
36
+ destroySession = library.destroySession
37
+ destroySession.argtypes = [ctypes.c_char_p]
38
+ destroySession.restype = ctypes.c_char_p