Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <!--- x-release-please-version -->
- Generator version: 7.17.0
- Generator version: 7.18.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen

## Requirements.
Expand Down
6 changes: 3 additions & 3 deletions sonarr/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
)

Expand Down Expand Up @@ -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]+)[\'"]?',
Expand Down
4 changes: 3 additions & 1 deletion sonarr/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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 "
Expand Down
9 changes: 6 additions & 3 deletions sonarr/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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

Expand Down
9 changes: 7 additions & 2 deletions sonarr/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down