notify-tls-client 2.0.1__py3-none-any.whl → 2.0.3__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.
@@ -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):
@@ -6,24 +6,59 @@ import os
6
6
 
7
7
 
8
8
  if platform == 'darwin':
9
- file_ext = '-arm64-*.dylib' if machine() == "arm64" else '-x86-*.dylib'
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']
10
14
  elif platform in ('win32', 'cygwin'):
11
- file_ext = '*-64-*.dll' if 8 == ctypes.sizeof(ctypes.c_voidp) else '*-32-*.dll'
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']
12
20
  else:
13
- if machine() == "aarch64":
14
- file_ext = '-arm64-*.so'
15
- elif "x86" in machine():
16
- file_ext = '-x86-*.so'
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']
17
29
  else:
18
- file_ext = '-amd64-*.so'
30
+ search_patterns = ['-linux-*.so', '*.so']
19
31
 
20
32
  root_dir = os.path.abspath(os.path.dirname(__file__))
21
33
  lib_dir = os.path.join(root_dir, 'dependencies')
22
34
  lib_path = None
23
- matches = glob(f'{root_dir}/dependencies/tls-client{file_ext}')
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
+
24
47
  if not matches:
25
- raise FileNotFoundError(f'No tls-client library found for the current platform: {platform} {machine()}')
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)
26
60
 
61
+ # Carregar a primeira biblioteca encontrada
27
62
  library = ctypes.cdll.LoadLibrary(matches[0])
28
63
 
29
64
  # extract the exposed request function from the shared package
@@ -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>
@@ -6,18 +6,18 @@ notify_tls_client/config/recovery_config.py,sha256=zKBjSdCHJ4iF0PXUawPh3EktOxGdn
6
6
  notify_tls_client/config/rotation_config.py,sha256=Av_K6BzgPknFYZXxe9WmDra8VGI9JEpDJSm0dDs8QqM,2089
7
7
  notify_tls_client/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  notify_tls_client/core/client_identifiers_manager.py,sha256=D8xJ89aaxZ_8Pssx9VqEH05G8cp3bMez14-KrTMtJiU,1646
9
- notify_tls_client/core/notifytlsclient.py,sha256=CcDS-yFj5g3Vw-mtbu_AFXZZD7wDjyPF_P5ha4vysqo,13307
9
+ notify_tls_client/core/notifytlsclient.py,sha256=JZSQ0frcYTuoLeiaWt7rwJh8IqgFtxZ6QLj1HG4MaD8,12650
10
10
  notify_tls_client/core/client/__init__.py,sha256=VKjpq02hC-r9ER6mbfkwG6W2ybv_jND9d9bidte0CjU,51
11
- notify_tls_client/core/client/decorators.py,sha256=TMKHLkWuVUy802TzY3iLwR1WV9QymcCxCelzBocPJH0,9705
11
+ notify_tls_client/core/client/decorators.py,sha256=oCmB_9vSyW3C0GEv1AiMIj_rJOwsZ2bHDVRD_QgJmQs,9693
12
12
  notify_tls_client/core/proxiesmanager/__init__.py,sha256=emF4vnZvSfb9zlHkt9dDdTcGwkfs1DADi7XVw_DxsWs,105
13
- notify_tls_client/core/proxiesmanager/proxiesmanager.py,sha256=kfW7nEIyeXtDj1YzaAZo2ctPGMk3MnNIXV15Cj7iiY0,3010
13
+ notify_tls_client/core/proxiesmanager/proxiesmanager.py,sha256=hcSw27wbt6UerJ5F8hfLjrIS8H1K-XwgZEa60lvGhXg,2902
14
14
  notify_tls_client/core/proxiesmanager/proxiesmanagerloader.py,sha256=7xr3SVdRnr95KWOdk15iehOCXG2huA-rY1j9VIe30YQ,1179
15
15
  notify_tls_client/tls_client/__init__.py,sha256=sThiIAzA650rfBlqZ_xalTjgTysUsjKua5ODnqyvhUE,669
16
16
  notify_tls_client/tls_client/__version__.py,sha256=32ZZ-ufGC9Yo6oPk5a1xig8YKJ2ZkRXnXoVqiqO0ptg,395
17
- notify_tls_client/tls_client/cffi.py,sha256=pedwBcQOwJvI66yp5GpyNU6zoqrQhTv3ocM1-1PtUm0,1291
17
+ notify_tls_client/tls_client/cffi.py,sha256=S8BQ5YOvphehia1CDmtEy_RNciw8F0wHNNLCNOZnnxg,3036
18
18
  notify_tls_client/tls_client/cookies.py,sha256=1fIOnFDMWMeXuAjQybSrUJXnyjhP-_jJ68AxBUZYgYU,15609
19
19
  notify_tls_client/tls_client/exceptions.py,sha256=xIoFb5H3Suk7XssQ-yw3I1DBkPLqnDXsiAe2MMp1qNQ,80
20
- notify_tls_client/tls_client/response.py,sha256=v4mQhZroNL9203mA5KDJvxSP4GntVq0sjYRtJNfIoE0,2732
20
+ notify_tls_client/tls_client/response.py,sha256=oMXdnbyppX5B1pYsk8h1UqZG01qHVOQCcnYrMG79ThI,2722
21
21
  notify_tls_client/tls_client/sessions.py,sha256=1xeUDR9H42wS900mCzkpu4At7Lx1O07QGoDuThbLG0M,19233
22
22
  notify_tls_client/tls_client/settings.py,sha256=x_2Vrph-QebbCjkxmnX8UPd5oYYU4ClqPOpfoqelno4,1485
23
23
  notify_tls_client/tls_client/structures.py,sha256=md-tJmo8X5bad0KrMUTVN8jxUIvui7NiBxaf10bLULU,2517
@@ -26,7 +26,7 @@ notify_tls_client/tls_client/dependencies/tls-client-darwin-amd64-1.12.0.dylib,s
26
26
  notify_tls_client/tls_client/dependencies/tls-client-linux-arm64-1.12.0.so,sha256=fQvdtCiRRS228WrFUE_ucq4OPC4Z7QU4_KI4B3Gf97Y,14404088
27
27
  notify_tls_client/tls_client/dependencies/tls-client-linux-ubuntu-amd64-1.12.0.so,sha256=UTvtZa93fWLWaSBINC_Cu8mNoLwsVdcQbQZsdQnZrJM,15210112
28
28
  notify_tls_client/tls_client/dependencies/tls-client-windows-64-1.12.0.dll,sha256=uk80UEGW8WepYMglh1Yo6VSrBSNDwon-OyFqE_1bWmM,24849278
29
- notify_tls_client-2.0.1.dist-info/METADATA,sha256=Fk4CucsgT0kffRjqOMLZQ1eFFDAU0Z3yg1YMCMdcdI4,10565
30
- notify_tls_client-2.0.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
31
- notify_tls_client-2.0.1.dist-info/top_level.txt,sha256=fq9YA0cFdpCuUO7cdMFN7oxm1zDfZm_m1KPXehUqA5o,18
32
- notify_tls_client-2.0.1.dist-info/RECORD,,
29
+ notify_tls_client-2.0.3.dist-info/METADATA,sha256=8jO38upUyUQm-ADHAjAI-PlS1XlCMLK5-CWX1f902eE,10565
30
+ notify_tls_client-2.0.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
31
+ notify_tls_client-2.0.3.dist-info/top_level.txt,sha256=fq9YA0cFdpCuUO7cdMFN7oxm1zDfZm_m1KPXehUqA5o,18
32
+ notify_tls_client-2.0.3.dist-info/RECORD,,