Skip to content

Commit 6f720b7

Browse files
github-actions[bot]MScottBlake
authored andcommitted
[auto] Updated Kandji SDK
1 parent 9767355 commit 6f720b7

File tree

6 files changed

+21
-11
lines changed

6 files changed

+21
-11
lines changed

.openapi-generator/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.17.0
1+
7.18.0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https:
138138

139139
- API version: 1.0.0
140140
- Package version: 1.0.0
141-
- Generator version: 7.17.0
141+
- Generator version: 7.18.0
142142
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
143143
For more information, please visit [https://github.com/MScottBlake/kandji-openapi](https://github.com/MScottBlake/kandji-openapi)
144144

kandji/api_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def response_deserialize(
313313
return_data = self.__deserialize_file(response_data)
314314
elif response_type is not None:
315315
match = None
316-
content_type = response_data.getheader('content-type')
316+
content_type = response_data.headers.get('content-type')
317317
if content_type is not None:
318318
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
319319
encoding = match.group(1) if match else "utf-8"
@@ -330,7 +330,7 @@ def response_deserialize(
330330
return ApiResponse(
331331
status_code = response_data.status,
332332
data = return_data,
333-
headers = response_data.getheaders(),
333+
headers = response_data.headers,
334334
raw_data = response_data.data
335335
)
336336

@@ -702,7 +702,7 @@ def __deserialize_file(self, response):
702702
os.close(fd)
703703
os.remove(path)
704704

705-
content_disposition = response.getheader("Content-Disposition")
705+
content_disposition = response.headers.get("Content-Disposition")
706706
if content_disposition:
707707
m = re.search(
708708
r'filename=[\'"]?([^\'"\s]+)[\'"]?',

kandji/configuration.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class Configuration:
165165
:param ca_cert_data: verify the peer using concatenated CA certificate data
166166
in PEM (str) or DER (bytes) format.
167167
:param cert_file: the path to a client certificate file, for mTLS.
168-
:param key_file: the path to a client key file, for mTLS.
168+
:param key_file: the path to a client key file, for mTLS.
169169
170170
:Example:
171171
"""
@@ -487,6 +487,7 @@ def get_basic_auth_token(self) -> Optional[str]:
487487
password = ""
488488
if self.password is not None:
489489
password = self.password
490+
490491
return urllib3.util.make_headers(
491492
basic_auth=username + ':' + password
492493
).get('authorization')
@@ -570,6 +571,7 @@ def get_host_from_settings(
570571
variable_name, variable['default_value'])
571572

572573
if 'enum_values' in variable \
574+
and variable['enum_values'] \
573575
and used_value not in variable['enum_values']:
574576
raise ValueError(
575577
"The variable `{0}` in the host URL has invalid value "

kandji/exceptions.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def __init__(
129129
self.body = http_resp.data.decode('utf-8')
130130
except Exception:
131131
pass
132-
self.headers = http_resp.getheaders()
132+
self.headers = http_resp.headers
133133

134134
@classmethod
135135
def from_response(
@@ -170,8 +170,11 @@ def __str__(self):
170170
error_message += "HTTP response headers: {0}\n".format(
171171
self.headers)
172172

173-
if self.data or self.body:
174-
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
173+
if self.body:
174+
error_message += "HTTP response body: {0}\n".format(self.body)
175+
176+
if self.data:
177+
error_message += "HTTP response data: {0}\n".format(self.data)
175178

176179
return error_message
177180

kandji/rest.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,17 @@ def read(self):
4949
self.data = self.response.data
5050
return self.data
5151

52+
@property
53+
def headers(self):
54+
"""Returns a dictionary of response headers."""
55+
return self.response.headers
56+
5257
def getheaders(self):
53-
"""Returns a dictionary of the response headers."""
58+
"""Returns a dictionary of the response headers; use ``headers`` instead."""
5459
return self.response.headers
5560

5661
def getheader(self, name, default=None):
57-
"""Returns a given response header."""
62+
"""Returns a given response header; use ``headers.get()`` instead."""
5863
return self.response.headers.get(name, default)
5964

6065

0 commit comments

Comments
 (0)