From 367348dd9e57030287e5ed9ac337be9987e569b6 Mon Sep 17 00:00:00 2001 From: "devopsarr[bot]" <127950054+devopsarr[bot]@users.noreply.github.com> Date: Mon, 22 Dec 2025 14:50:34 +0000 Subject: [PATCH] fix(deps): update openapitools/openapi-generator-cli docker tag to v7.18.0 --- README.md | 2 +- sonarr/api_client.py | 6 +++--- sonarr/configuration.py | 4 +++- sonarr/exceptions.py | 9 ++++++--- sonarr/rest.py | 9 +++++++-- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 48ac4a2..88d8829 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: - API version: v4.0.16.2944 - Package version: 1.1.1 -- Generator version: 7.17.0 +- Generator version: 7.18.0 - Build package: org.openapitools.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/sonarr/api_client.py b/sonarr/api_client.py index bd01372..f1813c5 100644 --- a/sonarr/api_client.py +++ b/sonarr/api_client.py @@ -312,7 +312,7 @@ def response_deserialize( return_data = self.__deserialize_file(response_data) elif response_type is not None: match = None - content_type = response_data.getheader('content-type') + content_type = response_data.headers.get('content-type') if content_type is not None: match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) encoding = match.group(1) if match else "utf-8" @@ -329,7 +329,7 @@ def response_deserialize( return ApiResponse( status_code = response_data.status, data = return_data, - headers = response_data.getheaders(), + headers = response_data.headers, raw_data = response_data.data ) @@ -701,7 +701,7 @@ def __deserialize_file(self, response): os.close(fd) os.remove(path) - content_disposition = response.getheader("Content-Disposition") + content_disposition = response.headers.get("Content-Disposition") if content_disposition: m = re.search( r'filename=[\'"]?([^\'"\s]+)[\'"]?', diff --git a/sonarr/configuration.py b/sonarr/configuration.py index 05a2130..f017264 100644 --- a/sonarr/configuration.py +++ b/sonarr/configuration.py @@ -165,7 +165,7 @@ class Configuration: :param ca_cert_data: verify the peer using concatenated CA certificate data in PEM (str) or DER (bytes) format. :param cert_file: the path to a client certificate file, for mTLS. - :param key_file: the path to a client key file, for mTLS. + :param key_file: the path to a client key file, for mTLS. :Example: @@ -506,6 +506,7 @@ def get_basic_auth_token(self) -> Optional[str]: password = "" if self.password is not None: password = self.password + return urllib3.util.make_headers( basic_auth=username + ':' + password ).get('authorization') @@ -607,6 +608,7 @@ def get_host_from_settings( variable_name, variable['default_value']) if 'enum_values' in variable \ + and variable['enum_values'] \ and used_value not in variable['enum_values']: raise ValueError( "The variable `{0}` in the host URL has invalid value " diff --git a/sonarr/exceptions.py b/sonarr/exceptions.py index 00b397f..7caea54 100644 --- a/sonarr/exceptions.py +++ b/sonarr/exceptions.py @@ -128,7 +128,7 @@ def __init__( self.body = http_resp.data.decode('utf-8') except Exception: pass - self.headers = http_resp.getheaders() + self.headers = http_resp.headers @classmethod def from_response( @@ -169,8 +169,11 @@ def __str__(self): error_message += "HTTP response headers: {0}\n".format( self.headers) - if self.data or self.body: - error_message += "HTTP response body: {0}\n".format(self.data or self.body) + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + if self.data: + error_message += "HTTP response data: {0}\n".format(self.data) return error_message diff --git a/sonarr/rest.py b/sonarr/rest.py index b209c0b..abd1052 100644 --- a/sonarr/rest.py +++ b/sonarr/rest.py @@ -48,12 +48,17 @@ def read(self): self.data = self.response.data return self.data + @property + def headers(self): + """Returns a dictionary of response headers.""" + return self.response.headers + def getheaders(self): - """Returns a dictionary of the response headers.""" + """Returns a dictionary of the response headers; use ``headers`` instead.""" return self.response.headers def getheader(self, name, default=None): - """Returns a given response header.""" + """Returns a given response header; use ``headers.get()`` instead.""" return self.response.headers.get(name, default)