lsrestclient 0.5.0__tar.gz → 0.6.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {lsrestclient-0.5.0 → lsrestclient-0.6.0}/PKG-INFO +1 -1
- {lsrestclient-0.5.0 → lsrestclient-0.6.0}/lsrestclient/response.py +24 -0
- {lsrestclient-0.5.0 → lsrestclient-0.6.0}/pyproject.toml +1 -1
- {lsrestclient-0.5.0 → lsrestclient-0.6.0}/README.md +0 -0
- {lsrestclient-0.5.0 → lsrestclient-0.6.0}/lsrestclient/__init__.py +0 -0
- {lsrestclient-0.5.0 → lsrestclient-0.6.0}/lsrestclient/client.py +0 -0
- {lsrestclient-0.5.0 → lsrestclient-0.6.0}/lsrestclient/exceptions.py +0 -0
@@ -38,3 +38,27 @@ class LsRestClientResponse:
|
|
38
38
|
content=response.content.decode("utf8"),
|
39
39
|
headers=response.headers,
|
40
40
|
)
|
41
|
+
|
42
|
+
@classmethod
|
43
|
+
def from_dict(cls, status_code: int = 200, data: dict = None, headers: CaseInsensitiveDict = None):
|
44
|
+
"""
|
45
|
+
Converts a dictionary into an instance of the LsRestClientResponse class.
|
46
|
+
|
47
|
+
:param status_code: The HTTP status code. Defaults to 200.
|
48
|
+
:param data: The data dictionary. Defaults to None.
|
49
|
+
:param headers: The headers dictionary. Defaults to None.
|
50
|
+
:return: An instance of the LsRestClientResponse class.
|
51
|
+
|
52
|
+
"""
|
53
|
+
if data is None:
|
54
|
+
data = {}
|
55
|
+
if headers is None:
|
56
|
+
headers = {}
|
57
|
+
|
58
|
+
content = lsjsonclasses.LSoftJSONEncoder.dumps(data)
|
59
|
+
|
60
|
+
return cls(
|
61
|
+
status_code=status_code,
|
62
|
+
content=content,
|
63
|
+
headers=headers
|
64
|
+
)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|