notify-tls-client 2.0.1__tar.gz → 2.0.3__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.
Files changed (39) hide show
  1. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/PKG-INFO +1 -1
  2. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/core/client/decorators.py +1 -1
  3. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/core/notifytlsclient.py +0 -10
  4. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/core/proxiesmanager/proxiesmanager.py +5 -10
  5. notify_tls_client-2.0.3/notify_tls_client/tls_client/cffi.py +75 -0
  6. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/tls_client/response.py +2 -3
  7. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client.egg-info/PKG-INFO +1 -1
  8. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/pyproject.toml +1 -1
  9. notify_tls_client-2.0.1/notify_tls_client/tls_client/cffi.py +0 -40
  10. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/MANIFEST.in +0 -0
  11. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/README.md +0 -0
  12. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/__init__.py +0 -0
  13. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/config/__init__.py +0 -0
  14. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/config/client_config.py +0 -0
  15. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/config/client_configuration.py +0 -0
  16. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/config/recovery_config.py +0 -0
  17. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/config/rotation_config.py +0 -0
  18. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/core/__init__.py +0 -0
  19. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/core/client/__init__.py +0 -0
  20. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/core/client_identifiers_manager.py +0 -0
  21. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/core/proxiesmanager/__init__.py +0 -0
  22. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/core/proxiesmanager/proxiesmanagerloader.py +0 -0
  23. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/tls_client/__init__.py +0 -0
  24. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/tls_client/__version__.py +0 -0
  25. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/tls_client/cookies.py +0 -0
  26. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/tls_client/dependencies/__init__.py +0 -0
  27. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/tls_client/dependencies/tls-client-darwin-amd64-1.12.0.dylib +0 -0
  28. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/tls_client/dependencies/tls-client-linux-arm64-1.12.0.so +0 -0
  29. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/tls_client/dependencies/tls-client-linux-ubuntu-amd64-1.12.0.so +0 -0
  30. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/tls_client/dependencies/tls-client-windows-64-1.12.0.dll +0 -0
  31. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/tls_client/exceptions.py +0 -0
  32. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/tls_client/sessions.py +0 -0
  33. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/tls_client/settings.py +0 -0
  34. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client/tls_client/structures.py +0 -0
  35. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client.egg-info/SOURCES.txt +0 -0
  36. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client.egg-info/dependency_links.txt +0 -0
  37. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client.egg-info/requires.txt +0 -0
  38. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/notify_tls_client.egg-info/top_level.txt +0 -0
  39. {notify_tls_client-2.0.1 → notify_tls_client-2.0.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: notify-tls-client
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Summary: Cliente HTTP avançado com TLS fingerprinting, rotação automática de proxies e recuperação inteligente para web scraping profissional
5
5
  Author-email: Jeferson Albara <jeferson.albara@example.com>
6
6
  Maintainer-email: Jeferson Albara <jeferson.albara@example.com>
@@ -3,7 +3,7 @@ from datetime import datetime
3
3
  from typing import Optional
4
4
  from urllib.parse import urlparse
5
5
 
6
- from orjson import orjson
6
+ import orjson
7
7
 
8
8
  from notify_tls_client.tls_client.response import Response
9
9
 
@@ -19,16 +19,6 @@ logger = logging.getLogger(__name__)
19
19
 
20
20
 
21
21
  class NotifyTLSClient:
22
- __slots__ = (
23
- 'config', 'client', 'free', 'requests_amount', 'requests_amount_with_current_proxy',
24
- 'requests_amount_with_current_client_identifier', 'last_request_status', 'current_proxy',
25
- '_lock', 'client_identifiers_manager', 'proxies_manager', 'requests_limit_with_same_proxy',
26
- 'requests_limit_with_same_client_identifier', 'random_tls_extension_order',
27
- 'instantiate_new_client_on_forbidden_response', 'instantiate_new_client_on_exception',
28
- 'change_client_identifier_on_forbidden_response', 'status_codes_to_forbidden_response_handle',
29
- 'disable_http3', 'debug_mode', 'headers'
30
- )
31
-
32
22
  def __init__(self,
33
23
  config: Optional[ClientConfiguration] = None,
34
24
  # Parâmetros legados - mantidos para compatibilidade mas deprecados
@@ -6,35 +6,30 @@ from dataclasses_json import dataclass_json
6
6
 
7
7
 
8
8
  @dataclass_json
9
- @dataclass
9
+ @dataclass(slots=True)
10
10
  class Proxy:
11
- __slots__ = ('host', 'port', 'username', 'password', '_proxy_dict_cache')
12
-
13
11
  host: str
14
12
  port: int
15
13
  username: Optional[str] = None
16
14
  password: Optional[str] = None
17
-
18
- def __post_init__(self):
19
- object.__setattr__(self, '_proxy_dict_cache', None)
15
+ _proxy_dict_cache: Optional[dict] = field(default=None, init=False, repr=False)
20
16
 
21
17
  def to_proxy_dict(self):
22
18
  if self._proxy_dict_cache is not None:
23
19
  return self._proxy_dict_cache
24
20
 
25
21
  if self.username is None:
26
- proxy_dict = {
22
+ self._proxy_dict_cache = {
27
23
  'http': 'http://' + self.host + ':' + str(self.port),
28
24
  'https': 'https://' + self.host + ':' + str(self.port)
29
25
  }
30
26
  else:
31
- proxy_dict = {
27
+ self._proxy_dict_cache = {
32
28
  'http': 'http://' + self.username + ':' + self.password + '@' + self.host + ':' + str(self.port),
33
29
  'https': 'https://' + self.username + ':' + self.password + '@' + self.host + ':' + str(self.port)
34
30
  }
35
31
 
36
- object.__setattr__(self, '_proxy_dict_cache', proxy_dict)
37
- return proxy_dict
32
+ return self._proxy_dict_cache
38
33
 
39
34
  def __eq__(self, other):
40
35
  if not isinstance(other, Proxy):
@@ -0,0 +1,75 @@
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
+ # macOS: buscar por tls-client-darwin-{arch}-*.dylib ou tls-client-{arch}-*.dylib
10
+ if machine() == "arm64":
11
+ search_patterns = ['-darwin-arm64-*.dylib', '-arm64-*.dylib']
12
+ else:
13
+ search_patterns = ['-darwin-amd64-*.dylib', '-darwin-x86-*.dylib', '-x86-*.dylib', '-amd64-*.dylib']
14
+ elif platform in ('win32', 'cygwin'):
15
+ # Windows: buscar por tls-client-windows-{bits}-*.dll ou tls-client-{bits}-*.dll
16
+ if 8 == ctypes.sizeof(ctypes.c_voidp):
17
+ search_patterns = ['-windows-64-*.dll', '-windows-amd64-*.dll', '-64-*.dll', '-amd64-*.dll']
18
+ else:
19
+ search_patterns = ['-windows-32-*.dll', '-windows-x86-*.dll', '-32-*.dll', '-x86-*.dll']
20
+ else:
21
+ # Linux: buscar por tls-client-linux-{distro}-{arch}-*.so ou tls-client-linux-{arch}-*.so ou tls-client-{arch}-*.so
22
+ machine_type = machine().lower()
23
+ if "aarch64" in machine_type or "arm64" in machine_type:
24
+ search_patterns = ['-linux-*-arm64-*.so', '-linux-arm64-*.so', '-arm64-*.so']
25
+ elif "x86_64" in machine_type or "amd64" in machine_type:
26
+ search_patterns = ['-linux-*-amd64-*.so', '-linux-amd64-*.so', '-amd64-*.so']
27
+ elif "x86" in machine_type or "i686" in machine_type or "i386" in machine_type:
28
+ search_patterns = ['-linux-*-x86-*.so', '-linux-x86-*.so', '-x86-*.so']
29
+ else:
30
+ search_patterns = ['-linux-*.so', '*.so']
31
+
32
+ root_dir = os.path.abspath(os.path.dirname(__file__))
33
+ lib_dir = os.path.join(root_dir, 'dependencies')
34
+ lib_path = None
35
+
36
+ # Buscar biblioteca compatível tentando múltiplos padrões
37
+ matches = []
38
+ tried_patterns = []
39
+
40
+ for pattern_suffix in search_patterns:
41
+ search_pattern = f'{root_dir}/dependencies/tls-client{pattern_suffix}'
42
+ tried_patterns.append(f'tls-client{pattern_suffix}')
43
+ matches = glob(search_pattern)
44
+ if matches:
45
+ break
46
+
47
+ if not matches:
48
+ # Listar arquivos disponíveis para debug
49
+ available_files = glob(f'{root_dir}/dependencies/tls-client*')
50
+ available_names = [os.path.basename(f) for f in available_files]
51
+
52
+ error_msg = (
53
+ f'Nenhuma biblioteca tls-client encontrada para a plataforma atual.\n'
54
+ f'Plataforma: {platform}\n'
55
+ f'Arquitetura: {machine()}\n'
56
+ f'Padrões testados: {tried_patterns}\n'
57
+ f'Arquivos disponíveis em dependencies/: {available_names}'
58
+ )
59
+ raise FileNotFoundError(error_msg)
60
+
61
+ # Carregar a primeira biblioteca encontrada
62
+ library = ctypes.cdll.LoadLibrary(matches[0])
63
+
64
+ # extract the exposed request function from the shared package
65
+ request = library.request
66
+ request.argtypes = [ctypes.c_char_p]
67
+ request.restype = ctypes.c_char_p
68
+
69
+ freeMemory = library.freeMemory
70
+ freeMemory.argtypes = [ctypes.c_char_p]
71
+ freeMemory.restype = ctypes.c_char_p
72
+
73
+ destroySession = library.destroySession
74
+ destroySession.argtypes = [ctypes.c_char_p]
75
+ destroySession.restype = ctypes.c_char_p
@@ -1,15 +1,14 @@
1
- from orjson import orjson
1
+ import orjson
2
2
 
3
3
  from .cookies import cookiejar_from_dict, RequestsCookieJar
4
4
  from .structures import CaseInsensitiveDict
5
5
 
6
6
  from typing import Union
7
- import json
8
7
 
9
8
 
10
9
  class Response:
11
10
  """object, which contains the response to an HTTP request."""
12
- __slots__ = ('elapsed', 'url', 'status_code', 'text', 'headers', 'cookies', '_content', '_content_consumed')
11
+ __slots__ = ('elapsed', 'url', 'status_code', 'text', 'headers', 'cookies', '_content', '_content_consumed', '__weakref__')
13
12
 
14
13
  def __init__(self):
15
14
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: notify-tls-client
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Summary: Cliente HTTP avançado com TLS fingerprinting, rotação automática de proxies e recuperação inteligente para web scraping profissional
5
5
  Author-email: Jeferson Albara <jeferson.albara@example.com>
6
6
  Maintainer-email: Jeferson Albara <jeferson.albara@example.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "notify-tls-client"
7
- version = "2.0.1"
7
+ version = "2.0.3"
8
8
  description = "Cliente HTTP avançado com TLS fingerprinting, rotação automática de proxies e recuperação inteligente para web scraping profissional"
9
9
  readme = {file = "README.md", content-type = "text/markdown"}
10
10
  requires-python = ">=3.12"
@@ -1,40 +0,0 @@
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
- lib_dir = os.path.join(root_dir, 'dependencies')
22
- lib_path = None
23
- matches = glob(f'{root_dir}/dependencies/tls-client{file_ext}')
24
- if not matches:
25
- raise FileNotFoundError(f'No tls-client library found for the current platform: {platform} {machine()}')
26
-
27
- library = ctypes.cdll.LoadLibrary(matches[0])
28
-
29
- # extract the exposed request function from the shared package
30
- request = library.request
31
- request.argtypes = [ctypes.c_char_p]
32
- request.restype = ctypes.c_char_p
33
-
34
- freeMemory = library.freeMemory
35
- freeMemory.argtypes = [ctypes.c_char_p]
36
- freeMemory.restype = ctypes.c_char_p
37
-
38
- destroySession = library.destroySession
39
- destroySession.argtypes = [ctypes.c_char_p]
40
- destroySession.restype = ctypes.c_char_p