diff --git a/.github/workflows/test-smoke.yml b/.github/workflows/test-smoke.yml index ebecd19b..ee90470f 100644 --- a/.github/workflows/test-smoke.yml +++ b/.github/workflows/test-smoke.yml @@ -5,7 +5,7 @@ on: - cron: "0 4 * * *" pull_request: paths: - - 'test/smoke/**' + - "test/smoke/**" - ".github/workflows/test-smoke.yml" workflow_dispatch: inputs: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 253062a5..83d63e88 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,9 +14,6 @@ stages: - pip install -r test-requirements.txt - pytest --cov=bandwidth -pytest-3.7: - extends: .pytest - image: python:3.7-alpine pytest-3.8: extends: .pytest image: python:3.8-alpine @@ -29,3 +26,6 @@ pytest-3.10: pytest-3.11: extends: .pytest image: python:3.11-alpine +pytest-3.12: + extends: .pytest + image: python:3.12-alpine diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 1985849f..b23eb275 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.7.0 +7.11.0 diff --git a/.travis.yml b/.travis.yml index 27e94b28..5eb462cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,13 @@ # ref: https://docs.travis-ci.com/user/languages/python language: python python: - - "3.7" - "3.8" - "3.9" - "3.10" - "3.11" + - "3.12" # uncomment the following if needed - #- "3.11-dev" # 3.11 development branch + #- "3.12-dev" # 3.12 development branch #- "nightly" # nightly build # command to install dependencies install: diff --git a/README.md b/README.md index 7e6188ea..666dd554 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,13 @@ This Python package is automatically generated by the [OpenAPI Generator](https: - API version: 1.0.0 - Package version: 1.0.0 -- Generator version: 7.7.0 +- Generator version: 7.11.0 - Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit [https://dev.bandwidth.com](https://dev.bandwidth.com) ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/bandwidth/api/calls_api.py b/bandwidth/api/calls_api.py index 1d1a13c4..f9d754dd 100644 --- a/bandwidth/api/calls_api.py +++ b/bandwidth/api/calls_api.py @@ -298,7 +298,9 @@ def _create_call_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -612,7 +614,9 @@ def _get_call_state_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -991,7 +995,9 @@ def _list_calls_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1334,7 +1340,9 @@ def _update_call_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1666,7 +1674,9 @@ def _update_call_bxml_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/bandwidth/api/conferences_api.py b/bandwidth/api/conferences_api.py index 1e8177f1..a3817228 100644 --- a/bandwidth/api/conferences_api.py +++ b/bandwidth/api/conferences_api.py @@ -18,7 +18,7 @@ from typing_extensions import Annotated from pydantic import Field, StrictBytes, StrictStr -from typing import List, Optional, Union +from typing import List, Optional, Tuple, Union from typing_extensions import Annotated from bandwidth.models.conference import Conference from bandwidth.models.conference_member import ConferenceMember @@ -312,7 +312,9 @@ def _download_conference_recording_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -617,7 +619,9 @@ def _get_conference_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -931,7 +935,9 @@ def _get_conference_member_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1247,7 +1253,9 @@ def _get_conference_recording_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1550,7 +1558,9 @@ def _list_conference_recordings_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1903,7 +1913,9 @@ def _list_conferences_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2235,7 +2247,9 @@ def _update_conference_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2564,7 +2578,9 @@ def _update_conference_bxml_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2906,7 +2922,9 @@ def _update_conference_member_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/bandwidth/api/media_api.py b/bandwidth/api/media_api.py index 38322248..571a3c8a 100644 --- a/bandwidth/api/media_api.py +++ b/bandwidth/api/media_api.py @@ -18,7 +18,7 @@ from typing_extensions import Annotated from pydantic import Field, StrictBytes, StrictStr -from typing import List, Optional, Union +from typing import List, Optional, Tuple, Union from typing_extensions import Annotated from bandwidth.models.media import Media @@ -295,7 +295,9 @@ def _delete_media_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -596,7 +598,9 @@ def _get_media_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -898,7 +902,9 @@ def _list_media_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -949,7 +955,7 @@ def upload_media( self, account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], media_id: Annotated[StrictStr, Field(description="Media ID to retrieve.")], - body: Union[StrictBytes, StrictStr], + body: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], content_type: Annotated[Optional[StrictStr], Field(description="The media type of the entity-body.")] = None, cache_control: Annotated[Optional[StrictStr], Field(description="General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain.")] = None, _request_timeout: Union[ @@ -1040,7 +1046,7 @@ def upload_media_with_http_info( self, account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], media_id: Annotated[StrictStr, Field(description="Media ID to retrieve.")], - body: Union[StrictBytes, StrictStr], + body: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], content_type: Annotated[Optional[StrictStr], Field(description="The media type of the entity-body.")] = None, cache_control: Annotated[Optional[StrictStr], Field(description="General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain.")] = None, _request_timeout: Union[ @@ -1131,7 +1137,7 @@ def upload_media_without_preload_content( self, account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], media_id: Annotated[StrictStr, Field(description="Media ID to retrieve.")], - body: Union[StrictBytes, StrictStr], + body: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], content_type: Annotated[Optional[StrictStr], Field(description="The media type of the entity-body.")] = None, cache_control: Annotated[Optional[StrictStr], Field(description="General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain.")] = None, _request_timeout: Union[ @@ -1238,7 +1244,9 @@ def _upload_media_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1259,6 +1267,9 @@ def _upload_media_serialize( if isinstance(body, str): with open(body, "rb") as _fp: _body_params = _fp.read() + elif isinstance(body, tuple): + # drop the filename from the tuple + _body_params = body[1] else: _body_params = body diff --git a/bandwidth/api/messages_api.py b/bandwidth/api/messages_api.py index 93af0c06..246a21d6 100644 --- a/bandwidth/api/messages_api.py +++ b/bandwidth/api/messages_api.py @@ -300,7 +300,9 @@ def _create_message_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -793,7 +795,9 @@ def _list_messages_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/bandwidth/api/mfa_api.py b/bandwidth/api/mfa_api.py index 562fc14f..5b10228b 100644 --- a/bandwidth/api/mfa_api.py +++ b/bandwidth/api/mfa_api.py @@ -286,7 +286,9 @@ def _generate_messaging_code_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -588,7 +590,9 @@ def _generate_voice_code_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -893,7 +897,9 @@ def _verify_code_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/bandwidth/api/phone_number_lookup_api.py b/bandwidth/api/phone_number_lookup_api.py index d380a255..3a7a4336 100644 --- a/bandwidth/api/phone_number_lookup_api.py +++ b/bandwidth/api/phone_number_lookup_api.py @@ -290,7 +290,9 @@ def _create_lookup_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -598,7 +600,9 @@ def _get_lookup_status_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/bandwidth/api/recordings_api.py b/bandwidth/api/recordings_api.py index 8ec8dfc8..dfdde315 100644 --- a/bandwidth/api/recordings_api.py +++ b/bandwidth/api/recordings_api.py @@ -18,7 +18,7 @@ from typing_extensions import Annotated from pydantic import Field, StrictBytes, StrictStr -from typing import List, Optional, Union +from typing import List, Optional, Tuple, Union from typing_extensions import Annotated from bandwidth.models.call_recording_metadata import CallRecordingMetadata from bandwidth.models.recording_transcriptions import RecordingTranscriptions @@ -311,7 +311,9 @@ def _delete_recording_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -627,7 +629,9 @@ def _delete_recording_media_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -943,7 +947,9 @@ def _delete_recording_transcription_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1259,7 +1265,9 @@ def _download_call_recording_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1577,7 +1585,9 @@ def _get_call_recording_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1893,7 +1903,9 @@ def _get_recording_transcription_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2235,7 +2247,9 @@ def _list_account_call_recordings_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2550,7 +2564,9 @@ def _list_call_recordings_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2877,7 +2893,9 @@ def _transcribe_call_recording_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -3208,7 +3226,9 @@ def _update_call_recording_state_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/bandwidth/api/statistics_api.py b/bandwidth/api/statistics_api.py index 6fe3af8f..4abbbc77 100644 --- a/bandwidth/api/statistics_api.py +++ b/bandwidth/api/statistics_api.py @@ -281,7 +281,9 @@ def _get_statistics_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/bandwidth/api/toll_free_verification_api.py b/bandwidth/api/toll_free_verification_api.py index d2523476..88677d18 100644 --- a/bandwidth/api/toll_free_verification_api.py +++ b/bandwidth/api/toll_free_verification_api.py @@ -300,7 +300,9 @@ def _create_webhook_subscription_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -614,7 +616,9 @@ def _delete_webhook_subscription_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -915,7 +919,9 @@ def _get_toll_free_verification_status_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1190,7 +1196,9 @@ def _list_toll_free_use_cases_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1471,7 +1479,9 @@ def _list_webhook_subscriptions_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1767,7 +1777,9 @@ def _request_toll_free_verification_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2091,7 +2103,9 @@ def _update_toll_free_verification_request_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2420,7 +2434,9 @@ def _update_webhook_subscription_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/bandwidth/api/transcriptions_api.py b/bandwidth/api/transcriptions_api.py index c1f0bf5e..eab5a3f1 100644 --- a/bandwidth/api/transcriptions_api.py +++ b/bandwidth/api/transcriptions_api.py @@ -309,7 +309,9 @@ def _delete_real_time_transcription_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -625,7 +627,9 @@ def _get_real_time_transcription_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -928,7 +932,9 @@ def _list_real_time_transcriptions_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/bandwidth/api_client.py b/bandwidth/api_client.py index dc19cc58..b361b95a 100644 --- a/bandwidth/api_client.py +++ b/bandwidth/api_client.py @@ -16,6 +16,7 @@ import datetime from dateutil.parser import parse from enum import Enum +import decimal import json import mimetypes import os @@ -67,6 +68,7 @@ class ApiClient: 'bool': bool, 'date': datetime.date, 'datetime': datetime.datetime, + 'decimal': decimal.Decimal, 'object': object, } _pool = None @@ -339,6 +341,7 @@ def sanitize_for_serialization(self, obj): If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date convert to string in iso8601 format. + If obj is decimal.Decimal return string representation. If obj is list, sanitize each element in the list. If obj is dict, return the dict. If obj is OpenAPI model, return the properties dict. @@ -364,6 +367,8 @@ def sanitize_for_serialization(self, obj): ) elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() + elif isinstance(obj, decimal.Decimal): + return str(obj) elif isinstance(obj, dict): obj_dict = obj @@ -400,12 +405,12 @@ def deserialize(self, response_text: str, response_type: str, content_type: Opti data = json.loads(response_text) except ValueError: data = response_text - elif content_type.startswith("application/json"): + elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): if response_text == "": data = "" else: data = json.loads(response_text) - elif content_type.startswith("text/plain"): + elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE): data = response_text else: raise ApiException( @@ -455,6 +460,8 @@ def __deserialize(self, data, klass): return self.__deserialize_date(data) elif klass == datetime.datetime: return self.__deserialize_datetime(data) + elif klass == decimal.Decimal: + return decimal.Decimal(data) elif issubclass(klass, Enum): return self.__deserialize_enum(data, klass) else: @@ -511,7 +518,7 @@ def parameters_to_url_query(self, params, collection_formats): if k in collection_formats: collection_format = collection_formats[k] if collection_format == 'multi': - new_params.extend((k, str(value)) for value in v) + new_params.extend((k, quote(str(value))) for value in v) else: if collection_format == 'ssv': delimiter = ' ' @@ -529,7 +536,10 @@ def parameters_to_url_query(self, params, collection_formats): return "&".join(["=".join(map(str, item)) for item in new_params]) - def files_parameters(self, files: Dict[str, Union[str, bytes]]): + def files_parameters( + self, + files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], + ): """Builds form parameters. :param files: File parameters. @@ -544,6 +554,12 @@ def files_parameters(self, files: Dict[str, Union[str, bytes]]): elif isinstance(v, bytes): filename = k filedata = v + elif isinstance(v, tuple): + filename, filedata = v + elif isinstance(v, list): + for file_param in v: + params.extend(self.files_parameters({k: file_param})) + continue else: raise ValueError("Unsupported file value") mimetype = ( diff --git a/bandwidth/configuration.py b/bandwidth/configuration.py index 3c835433..f5c38e1c 100644 --- a/bandwidth/configuration.py +++ b/bandwidth/configuration.py @@ -14,14 +14,16 @@ import copy +import http.client as httplib import logging from logging import FileHandler import multiprocessing import sys -from typing import Optional +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict +from typing_extensions import NotRequired, Self + import urllib3 -import http.client as httplib JSON_SCHEMA_VALIDATION_KEYWORDS = { 'multipleOf', 'maximum', 'exclusiveMaximum', @@ -29,6 +31,107 @@ 'minLength', 'pattern', 'maxItems', 'minItems' } +ServerVariablesT = Dict[str, str] + +GenericAuthSetting = TypedDict( + "GenericAuthSetting", + { + "type": str, + "in": str, + "key": str, + "value": str, + }, +) + + +OAuth2AuthSetting = TypedDict( + "OAuth2AuthSetting", + { + "type": Literal["oauth2"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +APIKeyAuthSetting = TypedDict( + "APIKeyAuthSetting", + { + "type": Literal["api_key"], + "in": str, + "key": str, + "value": Optional[str], + }, +) + + +BasicAuthSetting = TypedDict( + "BasicAuthSetting", + { + "type": Literal["basic"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": Optional[str], + }, +) + + +BearerFormatAuthSetting = TypedDict( + "BearerFormatAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "format": Literal["JWT"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +BearerAuthSetting = TypedDict( + "BearerAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +HTTPSignatureAuthSetting = TypedDict( + "HTTPSignatureAuthSetting", + { + "type": Literal["http-signature"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": None, + }, +) + + +AuthSettings = TypedDict( + "AuthSettings", + { + "Basic": BasicAuthSetting, + }, + total=False, +) + + +class HostSettingVariable(TypedDict): + description: str + default_value: str + enum_values: List[str] + + +class HostSetting(TypedDict): + url: str + description: str + variables: NotRequired[Dict[str, HostSettingVariable]] + + class Configuration: """This class contains various settings of the API client. @@ -79,20 +182,26 @@ class Configuration: """ - _default = None - - def __init__(self, host=None, - api_key=None, api_key_prefix=None, - username=None, password=None, - access_token=None, - server_index=None, server_variables=None, - server_operation_index=None, server_operation_variables=None, - ignore_operation_servers=False, - ssl_ca_cert=None, - retries=None, - *, - debug: Optional[bool] = None - ) -> None: + _default: ClassVar[Optional[Self]] = None + + def __init__( + self, + host: Optional[str]=None, + api_key: Optional[Dict[str, str]]=None, + api_key_prefix: Optional[Dict[str, str]]=None, + username: Optional[str]=None, + password: Optional[str]=None, + access_token: Optional[str]=None, + server_index: Optional[int]=None, + server_variables: Optional[ServerVariablesT]=None, + server_operation_index: Optional[Dict[int, int]]=None, + server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, + ignore_operation_servers: bool=False, + ssl_ca_cert: Optional[str]=None, + retries: Optional[int] = None, + *, + debug: Optional[bool] = None, + ) -> None: """Constructor """ self._base_path = "http://localhost" if host is None else host @@ -216,7 +325,7 @@ def __init__(self, host=None, """date format """ - def __deepcopy__(self, memo): + def __deepcopy__(self, memo: Dict[int, Any]) -> Self: cls = self.__class__ result = cls.__new__(cls) memo[id(self)] = result @@ -230,11 +339,11 @@ def __deepcopy__(self, memo): result.debug = self.debug return result - def __setattr__(self, name, value): + def __setattr__(self, name: str, value: Any) -> None: object.__setattr__(self, name, value) @classmethod - def set_default(cls, default): + def set_default(cls, default: Optional[Self]) -> None: """Set default instance of configuration. It stores default configuration, which can be @@ -245,7 +354,7 @@ def set_default(cls, default): cls._default = default @classmethod - def get_default_copy(cls): + def get_default_copy(cls) -> Self: """Deprecated. Please use `get_default` instead. Deprecated. Please use `get_default` instead. @@ -255,7 +364,7 @@ def get_default_copy(cls): return cls.get_default() @classmethod - def get_default(cls): + def get_default(cls) -> Self: """Return the default configuration. This method returns newly created, based on default constructor, @@ -265,11 +374,11 @@ def get_default(cls): :return: The configuration object. """ if cls._default is None: - cls._default = Configuration() + cls._default = cls() return cls._default @property - def logger_file(self): + def logger_file(self) -> Optional[str]: """The logger file. If the logger_file is None, then add stream handler and remove file @@ -281,7 +390,7 @@ def logger_file(self): return self.__logger_file @logger_file.setter - def logger_file(self, value): + def logger_file(self, value: Optional[str]) -> None: """The logger file. If the logger_file is None, then add stream handler and remove file @@ -300,7 +409,7 @@ def logger_file(self, value): logger.addHandler(self.logger_file_handler) @property - def debug(self): + def debug(self) -> bool: """Debug status :param value: The debug status, True or False. @@ -309,7 +418,7 @@ def debug(self): return self.__debug @debug.setter - def debug(self, value): + def debug(self, value: bool) -> None: """Debug status :param value: The debug status, True or False. @@ -331,7 +440,7 @@ def debug(self, value): httplib.HTTPConnection.debuglevel = 0 @property - def logger_format(self): + def logger_format(self) -> str: """The logger format. The logger_formatter will be updated when sets logger_format. @@ -342,7 +451,7 @@ def logger_format(self): return self.__logger_format @logger_format.setter - def logger_format(self, value): + def logger_format(self, value: str) -> None: """The logger format. The logger_formatter will be updated when sets logger_format. @@ -353,7 +462,7 @@ def logger_format(self, value): self.__logger_format = value self.logger_formatter = logging.Formatter(self.__logger_format) - def get_api_key_with_prefix(self, identifier, alias=None): + def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: """Gets API key (with prefix if set). :param identifier: The identifier of apiKey. @@ -370,7 +479,9 @@ def get_api_key_with_prefix(self, identifier, alias=None): else: return key - def get_basic_auth_token(self): + return None + + def get_basic_auth_token(self) -> Optional[str]: """Gets HTTP basic authentication header (string). :return: The token for basic HTTP authentication. @@ -385,12 +496,12 @@ def get_basic_auth_token(self): basic_auth=username + ':' + password ).get('authorization') - def auth_settings(self): + def auth_settings(self)-> AuthSettings: """Gets Auth Settings dict for api client. :return: The Auth Settings information dict. """ - auth = {} + auth: AuthSettings = {} if self.username is not None and self.password is not None: auth['Basic'] = { 'type': 'basic', @@ -400,7 +511,7 @@ def auth_settings(self): } return auth - def to_debug_report(self): + def to_debug_report(self) -> str: """Gets the essential information for debugging. :return: The report for debugging. @@ -412,7 +523,7 @@ def to_debug_report(self): "SDK Package Version: 1.0.0".\ format(env=sys.platform, pyversion=sys.version) - def get_host_settings(self): + def get_host_settings(self) -> List[HostSetting]: """Gets an array of host settings :return: An array of host settings @@ -424,7 +535,12 @@ def get_host_settings(self): } ] - def get_host_from_settings(self, index, variables=None, servers=None): + def get_host_from_settings( + self, + index: Optional[int], + variables: Optional[ServerVariablesT]=None, + servers: Optional[List[HostSetting]]=None, + ) -> str: """Gets host URL based on the index and variables :param index: array index of the host settings :param variables: hash of variable and the corresponding value @@ -464,12 +580,12 @@ def get_host_from_settings(self, index, variables=None, servers=None): return url @property - def host(self): + def host(self) -> str: """Return generated host.""" return self.get_host_from_settings(self.server_index, variables=self.server_variables) @host.setter - def host(self, value): + def host(self, value: str) -> None: """Fix base path.""" self._base_path = value self.server_index = None diff --git a/bandwidth/exceptions.py b/bandwidth/exceptions.py index be58575c..4578ae7f 100644 --- a/bandwidth/exceptions.py +++ b/bandwidth/exceptions.py @@ -151,6 +151,13 @@ def from_response( if http_resp.status == 404: raise NotFoundException(http_resp=http_resp, body=body, data=data) + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + if 500 <= http_resp.status <= 599: raise ServiceException(http_resp=http_resp, body=body, data=data) raise ApiException(http_resp=http_resp, body=body, data=data) @@ -189,6 +196,16 @@ class ServiceException(ApiException): pass +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + def render_path(path_to_item): """Returns a string representation of a path""" result = "" diff --git a/bandwidth/models/call_transcription_response.py b/bandwidth/models/call_transcription_response.py index df05441b..33a237cf 100644 --- a/bandwidth/models/call_transcription_response.py +++ b/bandwidth/models/call_transcription_response.py @@ -79,9 +79,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in tracks (list) _items = [] if self.tracks: - for _item in self.tracks: - if _item: - _items.append(_item.to_dict()) + for _item_tracks in self.tracks: + if _item_tracks: + _items.append(_item_tracks.to_dict()) _dict['tracks'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: diff --git a/bandwidth/models/conference.py b/bandwidth/models/conference.py index b361ec6e..4a0c9f74 100644 --- a/bandwidth/models/conference.py +++ b/bandwidth/models/conference.py @@ -85,9 +85,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in active_members (list) _items = [] if self.active_members: - for _item in self.active_members: - if _item: - _items.append(_item.to_dict()) + for _item_active_members in self.active_members: + if _item_active_members: + _items.append(_item_active_members.to_dict()) _dict['activeMembers'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: diff --git a/bandwidth/models/create_message_request_error.py b/bandwidth/models/create_message_request_error.py index 34ed1044..231a447f 100644 --- a/bandwidth/models/create_message_request_error.py +++ b/bandwidth/models/create_message_request_error.py @@ -78,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in field_errors (list) _items = [] if self.field_errors: - for _item in self.field_errors: - if _item: - _items.append(_item.to_dict()) + for _item_field_errors in self.field_errors: + if _item_field_errors: + _items.append(_item_field_errors.to_dict()) _dict['fieldErrors'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: diff --git a/bandwidth/models/error.py b/bandwidth/models/error.py index de70c7fe..33ac3e86 100644 --- a/bandwidth/models/error.py +++ b/bandwidth/models/error.py @@ -78,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in telephone_numbers (list) _items = [] if self.telephone_numbers: - for _item in self.telephone_numbers: - if _item: - _items.append(_item.to_dict()) + for _item_telephone_numbers in self.telephone_numbers: + if _item_telephone_numbers: + _items.append(_item_telephone_numbers.to_dict()) _dict['telephoneNumbers'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: diff --git a/bandwidth/models/lookup_status.py b/bandwidth/models/lookup_status.py index 4fdee59c..85d29de9 100644 --- a/bandwidth/models/lookup_status.py +++ b/bandwidth/models/lookup_status.py @@ -80,9 +80,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in result (list) _items = [] if self.result: - for _item in self.result: - if _item: - _items.append(_item.to_dict()) + for _item_result in self.result: + if _item_result: + _items.append(_item_result.to_dict()) _dict['result'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: diff --git a/bandwidth/models/messages_list.py b/bandwidth/models/messages_list.py index 93c2709b..51df6eb4 100644 --- a/bandwidth/models/messages_list.py +++ b/bandwidth/models/messages_list.py @@ -82,9 +82,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in messages (list) _items = [] if self.messages: - for _item in self.messages: - if _item: - _items.append(_item.to_dict()) + for _item_messages in self.messages: + if _item_messages: + _items.append(_item_messages.to_dict()) _dict['messages'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: diff --git a/bandwidth/models/recording_transcriptions.py b/bandwidth/models/recording_transcriptions.py index 6845cd9b..f30910e5 100644 --- a/bandwidth/models/recording_transcriptions.py +++ b/bandwidth/models/recording_transcriptions.py @@ -76,9 +76,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in transcripts (list) _items = [] if self.transcripts: - for _item in self.transcripts: - if _item: - _items.append(_item.to_dict()) + for _item_transcripts in self.transcripts: + if _item_transcripts: + _items.append(_item_transcripts.to_dict()) _dict['transcripts'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: diff --git a/bandwidth/models/verification_denial_webhook.py b/bandwidth/models/verification_denial_webhook.py index 98136d20..23897250 100644 --- a/bandwidth/models/verification_denial_webhook.py +++ b/bandwidth/models/verification_denial_webhook.py @@ -94,9 +94,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in additional_denial_reasons (list) _items = [] if self.additional_denial_reasons: - for _item in self.additional_denial_reasons: - if _item: - _items.append(_item.to_dict()) + for _item_additional_denial_reasons in self.additional_denial_reasons: + if _item_additional_denial_reasons: + _items.append(_item_additional_denial_reasons.to_dict()) _dict['additionalDenialReasons'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: diff --git a/bandwidth/models/webhook_subscriptions_list_body.py b/bandwidth/models/webhook_subscriptions_list_body.py index b3f73ddb..21cbeaec 100644 --- a/bandwidth/models/webhook_subscriptions_list_body.py +++ b/bandwidth/models/webhook_subscriptions_list_body.py @@ -83,16 +83,16 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in errors (list) _items = [] if self.errors: - for _item in self.errors: - if _item: - _items.append(_item.to_dict()) + for _item_errors in self.errors: + if _item_errors: + _items.append(_item_errors.to_dict()) _dict['errors'] = _items # override the default output from pydantic by calling `to_dict()` of each item in data (list) _items = [] if self.data: - for _item in self.data: - if _item: - _items.append(_item.to_dict()) + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) _dict['data'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: diff --git a/bandwidth/rest.py b/bandwidth/rest.py index c8582dad..454bb1c3 100644 --- a/bandwidth/rest.py +++ b/bandwidth/rest.py @@ -226,7 +226,7 @@ def request( headers=headers, preload_content=False ) - elif headers['Content-Type'] == 'text/plain' and isinstance(body, bool): + elif headers['Content-Type'].startswith('text/') and isinstance(body, bool): request_body = "true" if body else "false" r = self.pool_manager.request( method, diff --git a/openapitools.json b/openapitools.json index f227cf2d..973a005e 100644 --- a/openapitools.json +++ b/openapitools.json @@ -2,6 +2,6 @@ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "7.7.0" + "version": "7.11.0" } } diff --git a/pyproject.toml b/pyproject.toml index f3b4ac0b..bd66fc9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,19 +10,20 @@ keywords = ["OpenAPI", "OpenAPI-Generator", "Bandwidth"] include = ["bandwidth/py.typed"] [tool.poetry.dependencies] -python = "^3.7" +python = "^3.8" -urllib3 = ">= 1.25.3" -python-dateutil = ">=2.8.2" -pydantic = ">=2" -typing-extensions = ">=4.7.1" +urllib3 = ">= 1.25.3, < 3.0.0" +python-dateutil = ">= 2.8.2" +pydantic = ">= 2" +typing-extensions = ">= 4.7.1" [tool.poetry.dev-dependencies] -pytest = ">=7.2.1" -tox = ">=3.9.0" -flake8 = ">=4.0.0" -types-python-dateutil = ">=2.8.19.14" -mypy = "1.4.1" +pytest = ">= 7.2.1" +pytest-cov = ">= 2.8.1" +tox = ">= 3.9.0" +flake8 = ">= 4.0.0" +types-python-dateutil = ">= 2.8.19.14" +mypy = ">= 1.5" [build-system] @@ -48,7 +49,7 @@ warn_unused_ignores = true ## Getting these passing should be easy strict_equality = true -strict_concatenate = true +extra_checks = true ## Strongly recommend enabling this one as soon as you can check_untyped_defs = true @@ -69,3 +70,20 @@ disallow_any_generics = true # ### This one can be tricky to get passing if you use a lot of untyped libraries #warn_return_any = true + +[[tool.mypy.overrides]] +module = [ + "bandwidth.configuration", +] +warn_unused_ignores = true +strict_equality = true +extra_checks = true +check_untyped_defs = true +disallow_subclassing_any = true +disallow_untyped_decorators = true +disallow_any_generics = true +disallow_untyped_calls = true +disallow_incomplete_defs = true +disallow_untyped_defs = true +no_implicit_reexport = true +warn_return_any = true diff --git a/requirements.txt b/requirements.txt index 0f8f661e..67f7f68d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,4 @@ -python_dateutil >= 2.5.3 -setuptools >= 21.0.0 -urllib3 >= 1.25.3, <= 2.2.1 +urllib3 >= 1.25.3, < 3.0.0 +python_dateutil >= 2.8.2 pydantic >= 2 -aenum >= 3.1.11 typing-extensions >= 4.7.1 diff --git a/test-requirements.txt b/test-requirements.txt index c60905b5..c143f1ce 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,8 @@ -pytest~=7.1.3 -pytest-cov>=2.8.1 -pytest-randomly>=3.12.0 -pyhamcrest>=2.0.4 -mypy>=1.4.1 -types-python-dateutil>=2.8.19 +pytest >= 7.2.1 +pytest-cov >= 2.8.1 +pyhamcrest>=2.1.0 +tox >= 3.9.0 +flake8 >= 4.0.0 +types-python-dateutil >= 2.8.19.14 +mypy >= 1.5 zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability diff --git a/test/smoke/test_media_api.py b/test/smoke/test_media_api.py index 23147811..5d1c9a5e 100644 --- a/test/smoke/test_media_api.py +++ b/test/smoke/test_media_api.py @@ -88,6 +88,7 @@ def getMedia(self) -> None: logging.debug(api_response_with_http_info) assert_that(api_response_with_http_info.status_code, equal_to(200)) + assert_that(api_response_with_http_info.headers["Content-Type"], equal_to("image/jpeg")) api_response = self.api_instance.get_media( self.account_id, self.media_id)