tls-client-python 1.16.0.1__py3-none-win_arm64.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.
- tls_client/__init__.py +81 -0
- tls_client/_client_hints.py +162 -0
- tls_client/_core.py +4738 -0
- tls_client/_default_headers.py +370 -0
- tls_client/_multipart_boundary.py +54 -0
- tls_client/adapters.py +8 -0
- tls_client/auth.py +45 -0
- tls_client/bin/tls-client-windows-arm64.dll +0 -0
- tls_client/context.py +347 -0
- tls_client/cookies.py +189 -0
- tls_client/ech.py +50 -0
- tls_client/exceptions.py +91 -0
- tls_client/hooks.py +30 -0
- tls_client/models.py +6 -0
- tls_client/requests_compat.py +674 -0
- tls_client/status_codes.py +45 -0
- tls_client/structures.py +60 -0
- tls_client_python-1.16.0.1.dist-info/METADATA +620 -0
- tls_client_python-1.16.0.1.dist-info/RECORD +22 -0
- tls_client_python-1.16.0.1.dist-info/WHEEL +5 -0
- tls_client_python-1.16.0.1.dist-info/licenses/LICENSE +27 -0
- tls_client_python-1.16.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""HTTP status-code lookup compatible with ``requests.codes``."""
|
|
2
|
+
|
|
3
|
+
from tls_client.structures import LookupDict
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
codes = LookupDict(name="status_codes")
|
|
7
|
+
|
|
8
|
+
_NAMES = {
|
|
9
|
+
100: ("continue",),
|
|
10
|
+
200: ("ok", "okay", "all_ok"),
|
|
11
|
+
201: ("created",),
|
|
12
|
+
202: ("accepted",),
|
|
13
|
+
204: ("no_content",),
|
|
14
|
+
206: ("partial_content",),
|
|
15
|
+
300: ("multiple_choices",),
|
|
16
|
+
301: ("moved_permanently", "moved"),
|
|
17
|
+
302: ("found",),
|
|
18
|
+
303: ("see_other",),
|
|
19
|
+
304: ("not_modified",),
|
|
20
|
+
307: ("temporary_redirect", "temporary_moved"),
|
|
21
|
+
308: ("permanent_redirect",),
|
|
22
|
+
400: ("bad_request", "bad"),
|
|
23
|
+
401: ("unauthorized",),
|
|
24
|
+
403: ("forbidden",),
|
|
25
|
+
404: ("not_found", "not_found"),
|
|
26
|
+
405: ("method_not_allowed",),
|
|
27
|
+
408: ("request_timeout", "timeout"),
|
|
28
|
+
409: ("conflict",),
|
|
29
|
+
410: ("gone",),
|
|
30
|
+
413: ("request_entity_too_large",),
|
|
31
|
+
415: ("unsupported_media_type",),
|
|
32
|
+
418: ("im_a_teapot", "teapot"),
|
|
33
|
+
422: ("unprocessable_entity",),
|
|
34
|
+
429: ("too_many_requests", "too_many"),
|
|
35
|
+
500: ("internal_server_error", "server_error"),
|
|
36
|
+
502: ("bad_gateway",),
|
|
37
|
+
503: ("service_unavailable", "unavailable"),
|
|
38
|
+
504: ("gateway_timeout",),
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
for _code, _names in _NAMES.items():
|
|
42
|
+
setattr(codes, "_%s" % _code, _code)
|
|
43
|
+
for _name in _names:
|
|
44
|
+
setattr(codes, _name, _code)
|
|
45
|
+
|
tls_client/structures.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Small Requests-compatible container types."""
|
|
2
|
+
|
|
3
|
+
from collections import OrderedDict
|
|
4
|
+
from collections.abc import MutableMapping
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class CaseInsensitiveDict(MutableMapping):
|
|
8
|
+
"""Dictionary with case-insensitive string keys and preserved casing."""
|
|
9
|
+
|
|
10
|
+
def __init__(self, data=None, **kwargs):
|
|
11
|
+
self._store = OrderedDict()
|
|
12
|
+
if data is not None or kwargs:
|
|
13
|
+
self.update(data or {}, **kwargs)
|
|
14
|
+
|
|
15
|
+
def __setitem__(self, key, value):
|
|
16
|
+
self._store[str(key).lower()] = (str(key), value)
|
|
17
|
+
|
|
18
|
+
def __getitem__(self, key):
|
|
19
|
+
return self._store[str(key).lower()][1]
|
|
20
|
+
|
|
21
|
+
def __delitem__(self, key):
|
|
22
|
+
del self._store[str(key).lower()]
|
|
23
|
+
|
|
24
|
+
def __iter__(self):
|
|
25
|
+
return (item[0] for item in self._store.values())
|
|
26
|
+
|
|
27
|
+
def __len__(self):
|
|
28
|
+
return len(self._store)
|
|
29
|
+
|
|
30
|
+
def lower_items(self):
|
|
31
|
+
return ((key, value[1]) for key, value in self._store.items())
|
|
32
|
+
|
|
33
|
+
def copy(self):
|
|
34
|
+
return CaseInsensitiveDict(self.items())
|
|
35
|
+
|
|
36
|
+
def __eq__(self, other):
|
|
37
|
+
if isinstance(other, MutableMapping):
|
|
38
|
+
other = CaseInsensitiveDict(other)
|
|
39
|
+
else:
|
|
40
|
+
return NotImplemented
|
|
41
|
+
return dict(self.lower_items()) == dict(other.lower_items())
|
|
42
|
+
|
|
43
|
+
def __repr__(self):
|
|
44
|
+
return str(dict(self.items()))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class LookupDict(dict):
|
|
48
|
+
def __init__(self, name=None):
|
|
49
|
+
self.name = name
|
|
50
|
+
super(LookupDict, self).__init__()
|
|
51
|
+
|
|
52
|
+
def __getitem__(self, key):
|
|
53
|
+
return self.__dict__.get(key)
|
|
54
|
+
|
|
55
|
+
def get(self, key, default=None):
|
|
56
|
+
return self.__dict__.get(key, default)
|
|
57
|
+
|
|
58
|
+
def __repr__(self):
|
|
59
|
+
return "<lookup '%s'>" % self.name
|
|
60
|
+
|