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.17.2952
- Package version: 1.1.1 <!--- x-release-please-version -->
- Generator version: 7.20.0
- Generator version: 7.21.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen

## Requirements.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ requires-python = ">=3.9"
dependencies = [
"urllib3 (>=2.1.0,<3.0.0)",
"python-dateutil (>=2.8.2)",
"pydantic (>=2)",
"pydantic (>=2.11)",
"typing-extensions (>=4.7.1)",
]

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
urllib3 >= 2.1.0, < 3.0.0
python_dateutil >= 2.8.2
pydantic >= 2
pydantic >= 2.11
typing-extensions >= 4.7.1
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
REQUIRES = [
"urllib3 >= 2.1.0, < 3.0.0",
"python-dateutil >= 2.8.2",
"pydantic >= 2",
"pydantic >= 2.11",
"typing-extensions >= 4.7.1",
]

Expand Down
5 changes: 4 additions & 1 deletion sonarr/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class ApiClient:
'date': datetime.date,
'datetime': datetime.datetime,
'decimal': decimal.Decimal,
'UUID': uuid.UUID,
'object': object,
}
_pool = None
Expand Down Expand Up @@ -305,7 +306,7 @@ def response_deserialize(
response_text = None
return_data = None
try:
if response_type == "bytearray":
if response_type in ("bytearray", "bytes"):
return_data = response_data.data
elif response_type == "file":
return_data = self.__deserialize_file(response_data)
Expand Down Expand Up @@ -467,6 +468,8 @@ def __deserialize(self, data, klass):
return self.__deserialize_datetime(data)
elif klass is decimal.Decimal:
return decimal.Decimal(data)
elif klass is uuid.UUID:
return uuid.UUID(data)
elif issubclass(klass, Enum):
return self.__deserialize_enum(data, klass)
else:
Expand Down
50 changes: 35 additions & 15 deletions sonarr/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,25 @@ class Configuration:
string values to replace variables in templated server configuration.
The validation of enums is performed for variables with defined enum
values before.
:param verify_ssl: bool - Set this to false to skip verifying SSL certificate
when calling API from https server.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: int | urllib3.util.retry.Retry - Retry 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 assert_hostname: Set this to True/False to enable/disable SSL hostname verification.
:param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server.
:param connection_pool_maxsize: Connection pool max size. None in the constructor is coerced to 100 for async and cpu_count * 5 for sync.
:param proxy: Proxy URL.
:param proxy_headers: Proxy headers.
:param safe_chars_for_path_param: Safe characters for path parameter encoding.
:param client_side_validation: Enable client-side validation. Default True.
:param socket_options: Options to pass down to the underlying urllib3 socket.
:param datetime_format: Datetime format string for serialization.
:param date_format: Date format string for serialization.

:Example:

Expand Down Expand Up @@ -207,6 +219,17 @@ def __init__(
ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
verify_ssl: bool=True,
assert_hostname: Optional[bool]=None,
tls_server_name: Optional[str]=None,
connection_pool_maxsize: Optional[int]=None,
proxy: Optional[str]=None,
proxy_headers: Optional[Any]=None,
safe_chars_for_path_param: str='',
client_side_validation: bool=True,
socket_options: Optional[Any]=None,
datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z",
date_format: str="%Y-%m-%d",
*,
debug: Optional[bool] = None,
) -> None:
Expand Down Expand Up @@ -276,7 +299,7 @@ def __init__(
"""Debug switch
"""

self.verify_ssl = True
self.verify_ssl = verify_ssl
"""SSL/TLS verification
Set this to false to skip verifying SSL certificate when calling API
from https server.
Expand All @@ -294,46 +317,43 @@ def __init__(
self.key_file = key_file
"""client key file
"""
self.assert_hostname = None
self.assert_hostname = assert_hostname
"""Set this to True/False to enable/disable SSL hostname verification.
"""
self.tls_server_name = None
self.tls_server_name = tls_server_name
"""SSL/TLS Server Name Indication (SNI)
Set this to the SNI value expected by the server.
"""

self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else multiprocessing.cpu_count() * 5
"""urllib3 connection pool's maximum number of connections saved
per pool. urllib3 uses 1 connection as default value, but this is
not the best value when you are making a lot of possibly parallel
requests to the same host, which is often the case here.
cpu_count * 5 is used as default value to increase performance.
per pool. None in the constructor is coerced to cpu_count * 5.
"""

self.proxy: Optional[str] = None
self.proxy = proxy
"""Proxy URL
"""
self.proxy_headers = None
self.proxy_headers = proxy_headers
"""Proxy headers
"""
self.safe_chars_for_path_param = ''
self.safe_chars_for_path_param = safe_chars_for_path_param
"""Safe chars for path_param
"""
self.retries = retries
"""Retry configuration
"""
# Enable client side validation
self.client_side_validation = True
self.client_side_validation = client_side_validation

self.socket_options = None
self.socket_options = socket_options
"""Options to pass down to the underlying urllib3 socket
"""

self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
self.datetime_format = datetime_format
"""datetime format
"""

self.date_format = "%Y-%m-%d"
self.date_format = date_format
"""date format
"""

Expand Down
7 changes: 4 additions & 3 deletions sonarr/models/add_series_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from sonarr.models.monitor_types import MonitorTypes
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python

class AddSeriesOptions(BaseModel):
"""
Expand All @@ -35,7 +36,8 @@ class AddSeriesOptions(BaseModel):
__properties: ClassVar[List[str]] = ["ignoreEpisodesWithFiles", "ignoreEpisodesWithoutFiles", "monitor", "searchForMissingEpisodes", "searchForCutoffUnmetEpisodes"]

model_config = ConfigDict(
populate_by_name=True,
validate_by_name=True,
validate_by_alias=True,
validate_assignment=True,
protected_namespaces=(),
)
Expand All @@ -47,8 +49,7 @@ def to_str(self) -> str:

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
return json.dumps(to_jsonable_python(self.to_dict()))

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
Expand Down
7 changes: 4 additions & 3 deletions sonarr/models/alternate_title_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from typing import Any, ClassVar, Dict, Optional
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python

class AlternateTitleResource(BaseModel):
"""
Expand All @@ -34,7 +35,8 @@ class AlternateTitleResource(BaseModel):
__properties: ClassVar[List[str]] = ["title", "seasonNumber", "sceneSeasonNumber", "sceneOrigin", "comment"]

model_config = ConfigDict(
populate_by_name=True,
validate_by_name=True,
validate_by_alias=True,
validate_assignment=True,
protected_namespaces=(),
)
Expand All @@ -46,8 +48,7 @@ def to_str(self) -> str:

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
return json.dumps(to_jsonable_python(self.to_dict()))

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
Expand Down
7 changes: 4 additions & 3 deletions sonarr/models/auto_tagging_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from sonarr.models.auto_tagging_specification_schema import AutoTaggingSpecificationSchema
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python

class AutoTaggingResource(BaseModel):
"""
Expand All @@ -35,7 +36,8 @@ class AutoTaggingResource(BaseModel):
__properties: ClassVar[List[str]] = ["id", "name", "removeTagsAutomatically", "tags", "specifications"]

model_config = ConfigDict(
populate_by_name=True,
validate_by_name=True,
validate_by_alias=True,
validate_assignment=True,
protected_namespaces=(),
)
Expand All @@ -47,8 +49,7 @@ def to_str(self) -> str:

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
return json.dumps(to_jsonable_python(self.to_dict()))

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
Expand Down
7 changes: 4 additions & 3 deletions sonarr/models/auto_tagging_specification_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from sonarr.models.contract_field import ContractField
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python

class AutoTaggingSpecificationSchema(BaseModel):
"""
Expand All @@ -37,7 +38,8 @@ class AutoTaggingSpecificationSchema(BaseModel):
__properties: ClassVar[List[str]] = ["id", "name", "implementation", "implementationName", "negate", "required", "fields"]

model_config = ConfigDict(
populate_by_name=True,
validate_by_name=True,
validate_by_alias=True,
validate_assignment=True,
protected_namespaces=(),
)
Expand All @@ -49,8 +51,7 @@ def to_str(self) -> str:

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
return json.dumps(to_jsonable_python(self.to_dict()))

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
Expand Down
7 changes: 4 additions & 3 deletions sonarr/models/backup_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from sonarr.models.backup_type import BackupType
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python

class BackupResource(BaseModel):
"""
Expand All @@ -37,7 +38,8 @@ class BackupResource(BaseModel):
__properties: ClassVar[List[str]] = ["id", "name", "path", "type", "size", "time"]

model_config = ConfigDict(
populate_by_name=True,
validate_by_name=True,
validate_by_alias=True,
validate_assignment=True,
protected_namespaces=(),
)
Expand All @@ -49,8 +51,7 @@ def to_str(self) -> str:

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
return json.dumps(to_jsonable_python(self.to_dict()))

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
Expand Down
7 changes: 4 additions & 3 deletions sonarr/models/blocklist_bulk_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python

class BlocklistBulkResource(BaseModel):
"""
Expand All @@ -30,7 +31,8 @@ class BlocklistBulkResource(BaseModel):
__properties: ClassVar[List[str]] = ["ids"]

model_config = ConfigDict(
populate_by_name=True,
validate_by_name=True,
validate_by_alias=True,
validate_assignment=True,
protected_namespaces=(),
)
Expand All @@ -42,8 +44,7 @@ def to_str(self) -> str:

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
return json.dumps(to_jsonable_python(self.to_dict()))

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
Expand Down
7 changes: 4 additions & 3 deletions sonarr/models/blocklist_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from sonarr.models.series_resource import SeriesResource
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python

class BlocklistResource(BaseModel):
"""
Expand All @@ -47,7 +48,8 @@ class BlocklistResource(BaseModel):
__properties: ClassVar[List[str]] = ["id", "seriesId", "episodeIds", "sourceTitle", "languages", "quality", "customFormats", "date", "protocol", "indexer", "message", "series"]

model_config = ConfigDict(
populate_by_name=True,
validate_by_name=True,
validate_by_alias=True,
validate_assignment=True,
protected_namespaces=(),
)
Expand All @@ -59,8 +61,7 @@ def to_str(self) -> str:

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
return json.dumps(to_jsonable_python(self.to_dict()))

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
Expand Down
7 changes: 4 additions & 3 deletions sonarr/models/blocklist_resource_paging_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from sonarr.models.sort_direction import SortDirection
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python

class BlocklistResourcePagingResource(BaseModel):
"""
Expand All @@ -37,7 +38,8 @@ class BlocklistResourcePagingResource(BaseModel):
__properties: ClassVar[List[str]] = ["page", "pageSize", "sortKey", "sortDirection", "totalRecords", "records"]

model_config = ConfigDict(
populate_by_name=True,
validate_by_name=True,
validate_by_alias=True,
validate_assignment=True,
protected_namespaces=(),
)
Expand All @@ -49,8 +51,7 @@ def to_str(self) -> str:

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
return json.dumps(to_jsonable_python(self.to_dict()))

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
Expand Down
Loading