notify-tls-client 0.1.6__py3-none-any.whl → 2.0.0__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.
- notify_tls_client/__init__.py +2 -2
- notify_tls_client/config/__init__.py +18 -0
- notify_tls_client/config/client_config.py +76 -0
- notify_tls_client/config/client_configuration.py +237 -0
- notify_tls_client/config/recovery_config.py +66 -0
- notify_tls_client/config/rotation_config.py +56 -0
- notify_tls_client/core/client/__init__.py +1 -6
- notify_tls_client/core/client/decorators.py +200 -90
- notify_tls_client/core/client_identifiers_manager.py +44 -0
- notify_tls_client/core/notifytlsclient.py +271 -146
- notify_tls_client/core/proxiesmanager/__init__.py +1 -1
- notify_tls_client/core/proxiesmanager/proxiesmanager.py +79 -67
- notify_tls_client/core/proxiesmanager/proxiesmanagerloader.py +33 -33
- notify_tls_client/tls_client/__init__.py +14 -14
- notify_tls_client/tls_client/__version__.py +10 -10
- notify_tls_client/tls_client/cffi.py +40 -62
- notify_tls_client/tls_client/cookies.py +456 -456
- 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
- notify_tls_client/tls_client/dependencies/tls-client-linux-arm64-1.12.0.so +0 -0
- 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
- notify_tls_client/tls_client/dependencies/{tls-client-windows-1.11.0-64.dll → tls-client-windows-64-1.12.0.dll} +0 -0
- notify_tls_client/tls_client/exceptions.py +2 -2
- notify_tls_client/tls_client/response.py +84 -78
- notify_tls_client/tls_client/sessions.py +524 -513
- notify_tls_client/tls_client/settings.py +69 -69
- notify_tls_client/tls_client/structures.py +74 -74
- notify_tls_client-2.0.0.dist-info/METADATA +38 -0
- notify_tls_client-2.0.0.dist-info/RECORD +32 -0
- {notify_tls_client-0.1.6.dist-info → notify_tls_client-2.0.0.dist-info}/WHEEL +1 -1
- notify_tls_client-0.1.6.dist-info/METADATA +0 -16
- notify_tls_client-0.1.6.dist-info/RECORD +0 -25
- {notify_tls_client-0.1.6.dist-info → notify_tls_client-2.0.0.dist-info}/top_level.txt +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
class TLSClientExeption(IOError):
|
|
1
|
+
|
|
2
|
+
class TLSClientExeption(IOError):
|
|
3
3
|
"""General error with the TLS client"""
|
|
@@ -1,78 +1,84 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
self.
|
|
18
|
-
|
|
19
|
-
#
|
|
20
|
-
self.
|
|
21
|
-
|
|
22
|
-
#
|
|
23
|
-
self.
|
|
24
|
-
|
|
25
|
-
#
|
|
26
|
-
self.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
response
|
|
63
|
-
# Add
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
response.
|
|
78
|
-
|
|
1
|
+
from orjson import orjson
|
|
2
|
+
|
|
3
|
+
from .cookies import cookiejar_from_dict, RequestsCookieJar
|
|
4
|
+
from .structures import CaseInsensitiveDict
|
|
5
|
+
|
|
6
|
+
from typing import Union
|
|
7
|
+
import json
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Response:
|
|
11
|
+
"""object, which contains the response to an HTTP request."""
|
|
12
|
+
|
|
13
|
+
def __init__(self):
|
|
14
|
+
|
|
15
|
+
# Reference of URL the response is coming from (especially useful with redirects)
|
|
16
|
+
self.elapsed = None
|
|
17
|
+
self.url = None
|
|
18
|
+
|
|
19
|
+
# Integer Code of responded HTTP Status, e.g. 404 or 200.
|
|
20
|
+
self.status_code = None
|
|
21
|
+
|
|
22
|
+
# String of responded HTTP Body.
|
|
23
|
+
self.text = None
|
|
24
|
+
|
|
25
|
+
# Case-insensitive Dictionary of Response Headers.
|
|
26
|
+
self.headers = CaseInsensitiveDict()
|
|
27
|
+
|
|
28
|
+
# A CookieJar of Cookies the server sent back.
|
|
29
|
+
self.cookies = cookiejar_from_dict({})
|
|
30
|
+
|
|
31
|
+
self._content = False
|
|
32
|
+
self._content_consumed = False
|
|
33
|
+
|
|
34
|
+
def __enter__(self):
|
|
35
|
+
return self
|
|
36
|
+
|
|
37
|
+
def __repr__(self):
|
|
38
|
+
return f"<Response [{self.status_code}]>"
|
|
39
|
+
|
|
40
|
+
def json(self, **kwargs):
|
|
41
|
+
"""parse response body to json (dict/list)"""
|
|
42
|
+
return orjson.loads(self.text, **kwargs)
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def content(self):
|
|
46
|
+
"""Content of the response, in bytes."""
|
|
47
|
+
|
|
48
|
+
if self._content is False:
|
|
49
|
+
if self._content_consumed:
|
|
50
|
+
raise RuntimeError("The content for this response was already consumed")
|
|
51
|
+
|
|
52
|
+
if self.status_code == 0:
|
|
53
|
+
self._content = None
|
|
54
|
+
else:
|
|
55
|
+
self._content = b"".join(self.iter_content(10 * 1024)) or b""
|
|
56
|
+
self._content_consumed = True
|
|
57
|
+
return self._content
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def build_response(res: Union[dict, list], res_cookies: RequestsCookieJar) -> Response:
|
|
61
|
+
"""Builds a Response object """
|
|
62
|
+
response = Response()
|
|
63
|
+
# Add target / url
|
|
64
|
+
response.url = res.get("target", None)
|
|
65
|
+
# Add status code
|
|
66
|
+
response.status_code = res.get("status", 0)
|
|
67
|
+
|
|
68
|
+
response.elapsed = res.get("elapsed", None)
|
|
69
|
+
# Add headers
|
|
70
|
+
response_headers = {}
|
|
71
|
+
if res.get('headers', None) is not None:
|
|
72
|
+
for header_key, header_value in res["headers"].items():
|
|
73
|
+
if len(header_value) == 1:
|
|
74
|
+
response_headers[header_key] = header_value[0]
|
|
75
|
+
else:
|
|
76
|
+
response_headers[header_key] = header_value
|
|
77
|
+
response.headers = response_headers
|
|
78
|
+
# Add cookies
|
|
79
|
+
response.cookies = None
|
|
80
|
+
# Add response body
|
|
81
|
+
response.text = res["body"]
|
|
82
|
+
# Add response content (bytes)
|
|
83
|
+
response._content = res["body"].encode()
|
|
84
|
+
return response
|