spotify-apimatic-sdk 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spotify_apimatic_sdk-1.0.0.dist-info/METADATA +150 -0
- spotify_apimatic_sdk-1.0.0.dist-info/RECORD +186 -0
- spotify_apimatic_sdk-1.0.0.dist-info/WHEEL +5 -0
- spotify_apimatic_sdk-1.0.0.dist-info/licenses/LICENSE +30 -0
- spotify_apimatic_sdk-1.0.0.dist-info/top_level.txt +1 -0
- spotifywebapi/__init__.py +12 -0
- spotifywebapi/api_helper.py +19 -0
- spotifywebapi/configuration.py +318 -0
- spotifywebapi/controllers/__init__.py +20 -0
- spotifywebapi/controllers/albums_controller.py +498 -0
- spotifywebapi/controllers/artists_controller.py +327 -0
- spotifywebapi/controllers/audiobooks_controller.py +441 -0
- spotifywebapi/controllers/base_controller.py +67 -0
- spotifywebapi/controllers/categories_controller.py +161 -0
- spotifywebapi/controllers/chapters_controller.py +157 -0
- spotifywebapi/controllers/episodes_controller.py +390 -0
- spotifywebapi/controllers/genres_controller.py +84 -0
- spotifywebapi/controllers/markets_controller.py +82 -0
- spotifywebapi/controllers/o_auth_authorization_controller.py +156 -0
- spotifywebapi/controllers/player_controller.py +807 -0
- spotifywebapi/controllers/playlists_controller.py +851 -0
- spotifywebapi/controllers/search_controller.py +123 -0
- spotifywebapi/controllers/shows_controller.py +439 -0
- spotifywebapi/controllers/tracks_controller.py +821 -0
- spotifywebapi/controllers/users_controller.py +649 -0
- spotifywebapi/exceptions/__init__.py +11 -0
- spotifywebapi/exceptions/api_exception.py +36 -0
- spotifywebapi/exceptions/bad_request_exception.py +56 -0
- spotifywebapi/exceptions/forbidden_exception.py +56 -0
- spotifywebapi/exceptions/not_found_exception.py +56 -0
- spotifywebapi/exceptions/o_auth_provider_exception.py +73 -0
- spotifywebapi/exceptions/too_many_requests_exception.py +56 -0
- spotifywebapi/exceptions/unauthorized_exception.py +56 -0
- spotifywebapi/http/__init__.py +11 -0
- spotifywebapi/http/api_response.py +67 -0
- spotifywebapi/http/auth/__init__.py +5 -0
- spotifywebapi/http/auth/o_auth_2.py +336 -0
- spotifywebapi/http/http_call_back.py +20 -0
- spotifywebapi/http/http_client_provider.py +23 -0
- spotifywebapi/http/http_method_enum.py +25 -0
- spotifywebapi/http/http_request.py +55 -0
- spotifywebapi/http/http_response.py +45 -0
- spotifywebapi/http/proxy_settings.py +50 -0
- spotifywebapi/models/__init__.py +142 -0
- spotifywebapi/models/album_base.py +264 -0
- spotifywebapi/models/album_group_enum.py +51 -0
- spotifywebapi/models/album_object.py +375 -0
- spotifywebapi/models/album_restriction_object.py +109 -0
- spotifywebapi/models/album_type_enum.py +62 -0
- spotifywebapi/models/artist_discography_album_object.py +298 -0
- spotifywebapi/models/artist_object.py +335 -0
- spotifywebapi/models/audio_analysis_object.py +266 -0
- spotifywebapi/models/audio_features_object.py +518 -0
- spotifywebapi/models/audiobook_base.py +353 -0
- spotifywebapi/models/audiobook_object.py +369 -0
- spotifywebapi/models/author_object.py +85 -0
- spotifywebapi/models/categories.py +162 -0
- spotifywebapi/models/category_object.py +117 -0
- spotifywebapi/models/chapter_base.py +392 -0
- spotifywebapi/models/chapter_object.py +408 -0
- spotifywebapi/models/chapter_restriction_object.py +113 -0
- spotifywebapi/models/context_object.py +181 -0
- spotifywebapi/models/copyright_object.py +130 -0
- spotifywebapi/models/currently_playing_context_object.py +314 -0
- spotifywebapi/models/currently_playing_object.py +241 -0
- spotifywebapi/models/cursor_object.py +108 -0
- spotifywebapi/models/cursor_paged_artists.py +75 -0
- spotifywebapi/models/cursor_paging_object.py +183 -0
- spotifywebapi/models/cursor_paging_play_history_object.py +214 -0
- spotifywebapi/models/cursor_paging_simplified_artist_object.py +213 -0
- spotifywebapi/models/device_object.py +278 -0
- spotifywebapi/models/disallows_object.py +314 -0
- spotifywebapi/models/episode_base.py +394 -0
- spotifywebapi/models/episode_object.py +665 -0
- spotifywebapi/models/episode_restriction_object.py +112 -0
- spotifywebapi/models/error_object.py +85 -0
- spotifywebapi/models/explicit_content_settings_object.py +110 -0
- spotifywebapi/models/external_id_object.py +156 -0
- spotifywebapi/models/external_url_object.py +107 -0
- spotifywebapi/models/followers_object.py +134 -0
- spotifywebapi/models/image_object.py +168 -0
- spotifywebapi/models/include_external_enum.py +45 -0
- spotifywebapi/models/item_type_1_enum.py +56 -0
- spotifywebapi/models/item_type_2_enum.py +45 -0
- spotifywebapi/models/item_type_3_enum.py +45 -0
- spotifywebapi/models/item_type_enum.py +58 -0
- spotifywebapi/models/linked_track_object.py +205 -0
- spotifywebapi/models/many_albums.py +76 -0
- spotifywebapi/models/many_artists.py +76 -0
- spotifywebapi/models/many_audio_features.py +77 -0
- spotifywebapi/models/many_audiobooks.py +77 -0
- spotifywebapi/models/many_chapters.py +77 -0
- spotifywebapi/models/many_devices.py +76 -0
- spotifywebapi/models/many_episodes.py +77 -0
- spotifywebapi/models/many_genres.py +69 -0
- spotifywebapi/models/many_simplified_shows.py +74 -0
- spotifywebapi/models/many_tracks.py +76 -0
- spotifywebapi/models/markets.py +85 -0
- spotifywebapi/models/me_albums_request.py +90 -0
- spotifywebapi/models/me_episodes_request.py +73 -0
- spotifywebapi/models/me_episodes_request_1.py +89 -0
- spotifywebapi/models/me_following_request.py +74 -0
- spotifywebapi/models/me_following_request_1.py +90 -0
- spotifywebapi/models/me_player_play_request.py +165 -0
- spotifywebapi/models/me_player_request.py +103 -0
- spotifywebapi/models/me_shows_request.py +89 -0
- spotifywebapi/models/me_tracks_request.py +74 -0
- spotifywebapi/models/me_tracks_request_1.py +90 -0
- spotifywebapi/models/meta.py +227 -0
- spotifywebapi/models/mode_enum.py +52 -0
- spotifywebapi/models/narrator_object.py +85 -0
- spotifywebapi/models/o_auth_provider_error_enum.py +67 -0
- spotifywebapi/models/o_auth_scope_enum.py +98 -0
- spotifywebapi/models/o_auth_token.py +113 -0
- spotifywebapi/models/paged_albums.py +75 -0
- spotifywebapi/models/paged_categories.py +74 -0
- spotifywebapi/models/paging_artist_discography_album_object.py +163 -0
- spotifywebapi/models/paging_artist_object.py +162 -0
- spotifywebapi/models/paging_featured_playlist_object.py +113 -0
- spotifywebapi/models/paging_object.py +142 -0
- spotifywebapi/models/paging_playlist_object.py +163 -0
- spotifywebapi/models/paging_playlist_track_object.py +163 -0
- spotifywebapi/models/paging_saved_album_object.py +163 -0
- spotifywebapi/models/paging_saved_audiobook_object.py +163 -0
- spotifywebapi/models/paging_saved_episode_object.py +163 -0
- spotifywebapi/models/paging_saved_show_object.py +163 -0
- spotifywebapi/models/paging_saved_track_object.py +163 -0
- spotifywebapi/models/paging_simplified_album_object.py +163 -0
- spotifywebapi/models/paging_simplified_audiobook_object.py +162 -0
- spotifywebapi/models/paging_simplified_chapter_object.py +162 -0
- spotifywebapi/models/paging_simplified_episode_object.py +162 -0
- spotifywebapi/models/paging_simplified_show_object.py +160 -0
- spotifywebapi/models/paging_simplified_track_object.py +163 -0
- spotifywebapi/models/paging_track_object.py +162 -0
- spotifywebapi/models/play_history_object.py +141 -0
- spotifywebapi/models/playlist_object.py +425 -0
- spotifywebapi/models/playlist_owner_object.py +238 -0
- spotifywebapi/models/playlist_snapshot_id.py +85 -0
- spotifywebapi/models/playlist_track_object.py +171 -0
- spotifywebapi/models/playlist_tracks_ref_object.py +109 -0
- spotifywebapi/models/playlist_user_object.py +231 -0
- spotifywebapi/models/playlists_followers_request.py +86 -0
- spotifywebapi/models/playlists_request.py +160 -0
- spotifywebapi/models/playlists_tracks_request.py +121 -0
- spotifywebapi/models/playlists_tracks_request_1.py +188 -0
- spotifywebapi/models/playlists_tracks_request_2.py +109 -0
- spotifywebapi/models/private_user_object.py +379 -0
- spotifywebapi/models/public_user_object.py +268 -0
- spotifywebapi/models/queue_object.py +118 -0
- spotifywebapi/models/reason_enum.py +65 -0
- spotifywebapi/models/recommendation_seed_object.py +208 -0
- spotifywebapi/models/recommendations_object.py +96 -0
- spotifywebapi/models/release_date_precision_enum.py +62 -0
- spotifywebapi/models/resume_point_object.py +131 -0
- spotifywebapi/models/saved_album_object.py +118 -0
- spotifywebapi/models/saved_audiobook_object.py +118 -0
- spotifywebapi/models/saved_episode_object.py +116 -0
- spotifywebapi/models/saved_show_object.py +116 -0
- spotifywebapi/models/saved_track_object.py +118 -0
- spotifywebapi/models/search_items.py +256 -0
- spotifywebapi/models/section_object.py +362 -0
- spotifywebapi/models/segment_object.py +307 -0
- spotifywebapi/models/show_base.py +550 -0
- spotifywebapi/models/show_object.py +319 -0
- spotifywebapi/models/simplified_album_object.py +468 -0
- spotifywebapi/models/simplified_artist_object.py +228 -0
- spotifywebapi/models/simplified_playlist_object.py +398 -0
- spotifywebapi/models/simplified_track_object.py +494 -0
- spotifywebapi/models/time_interval_object.py +132 -0
- spotifywebapi/models/track.py +697 -0
- spotifywebapi/models/track_1.py +85 -0
- spotifywebapi/models/track_object.py +605 -0
- spotifywebapi/models/track_restriction_object.py +112 -0
- spotifywebapi/models/type_2_enum.py +56 -0
- spotifywebapi/models/type_3_enum.py +56 -0
- spotifywebapi/models/type_4_enum.py +56 -0
- spotifywebapi/models/type_5_enum.py +56 -0
- spotifywebapi/models/type_6_enum.py +56 -0
- spotifywebapi/models/type_8_enum.py +42 -0
- spotifywebapi/models/type_9_enum.py +42 -0
- spotifywebapi/models/type_enum.py +56 -0
- spotifywebapi/models/users_playlists_request.py +154 -0
- spotifywebapi/spotifywebapi_client.py +198 -0
- spotifywebapi/utilities/__init__.py +6 -0
- spotifywebapi/utilities/file_wrapper.py +45 -0
- spotifywebapi/utilities/union_type_lookup.py +113 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""spotifywebapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: E501
|
|
7
|
+
from spotifywebapi.api_helper import APIHelper
|
|
8
|
+
from spotifywebapi.exceptions.api_exception import (
|
|
9
|
+
APIException,
|
|
10
|
+
)
|
|
11
|
+
from spotifywebapi.models.error_object import (
|
|
12
|
+
ErrorObject,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class BadRequestException(APIException):
|
|
17
|
+
def __init__(self, reason, response):
|
|
18
|
+
"""Initialize BadRequestException object.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
reason (string): The reason (or error message) for the Exception
|
|
22
|
+
to be raised.
|
|
23
|
+
response (HttpResponse): The HttpResponse of the API call.
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
super(BadRequestException, self).__init__(reason, response)
|
|
27
|
+
dictionary = APIHelper.json_deserialize(self.response.text)
|
|
28
|
+
if isinstance(dictionary, dict):
|
|
29
|
+
self.unbox(dictionary)
|
|
30
|
+
|
|
31
|
+
def unbox(self, dictionary):
|
|
32
|
+
"""Populate the properties of this object by extracting them from a dictionary.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
dictionary (dictionary): A dictionary representation of the object as
|
|
36
|
+
obtained from the deserialization of the server's response. The keys
|
|
37
|
+
MUST match property names in the API description.
|
|
38
|
+
|
|
39
|
+
"""
|
|
40
|
+
self.error =\
|
|
41
|
+
ErrorObject.from_dictionary(
|
|
42
|
+
dictionary.get("error"))\
|
|
43
|
+
if dictionary.get("error") else None
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def __str__(self):
|
|
47
|
+
"""Return a human-readable string representation."""
|
|
48
|
+
_error=self.error
|
|
49
|
+
_base_str = super().__str__()
|
|
50
|
+
_base_str = _base_str[_base_str.find("(") + 1:-1]
|
|
51
|
+
return (
|
|
52
|
+
f"{self.__class__.__name__}("
|
|
53
|
+
f"base_str={_base_str!s}, "
|
|
54
|
+
f"error={_error!s}, "
|
|
55
|
+
f")"
|
|
56
|
+
)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""spotifywebapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: E501
|
|
7
|
+
from spotifywebapi.api_helper import APIHelper
|
|
8
|
+
from spotifywebapi.exceptions.api_exception import (
|
|
9
|
+
APIException,
|
|
10
|
+
)
|
|
11
|
+
from spotifywebapi.models.error_object import (
|
|
12
|
+
ErrorObject,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ForbiddenException(APIException):
|
|
17
|
+
def __init__(self, reason, response):
|
|
18
|
+
"""Initialize ForbiddenException object.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
reason (string): The reason (or error message) for the Exception
|
|
22
|
+
to be raised.
|
|
23
|
+
response (HttpResponse): The HttpResponse of the API call.
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
super(ForbiddenException, self).__init__(reason, response)
|
|
27
|
+
dictionary = APIHelper.json_deserialize(self.response.text)
|
|
28
|
+
if isinstance(dictionary, dict):
|
|
29
|
+
self.unbox(dictionary)
|
|
30
|
+
|
|
31
|
+
def unbox(self, dictionary):
|
|
32
|
+
"""Populate the properties of this object by extracting them from a dictionary.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
dictionary (dictionary): A dictionary representation of the object as
|
|
36
|
+
obtained from the deserialization of the server's response. The keys
|
|
37
|
+
MUST match property names in the API description.
|
|
38
|
+
|
|
39
|
+
"""
|
|
40
|
+
self.error =\
|
|
41
|
+
ErrorObject.from_dictionary(
|
|
42
|
+
dictionary.get("error"))\
|
|
43
|
+
if dictionary.get("error") else None
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def __str__(self):
|
|
47
|
+
"""Return a human-readable string representation."""
|
|
48
|
+
_error=self.error
|
|
49
|
+
_base_str = super().__str__()
|
|
50
|
+
_base_str = _base_str[_base_str.find("(") + 1:-1]
|
|
51
|
+
return (
|
|
52
|
+
f"{self.__class__.__name__}("
|
|
53
|
+
f"base_str={_base_str!s}, "
|
|
54
|
+
f"error={_error!s}, "
|
|
55
|
+
f")"
|
|
56
|
+
)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""spotifywebapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: E501
|
|
7
|
+
from spotifywebapi.api_helper import APIHelper
|
|
8
|
+
from spotifywebapi.exceptions.api_exception import (
|
|
9
|
+
APIException,
|
|
10
|
+
)
|
|
11
|
+
from spotifywebapi.models.error_object import (
|
|
12
|
+
ErrorObject,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class NotFoundException(APIException):
|
|
17
|
+
def __init__(self, reason, response):
|
|
18
|
+
"""Initialize NotFoundException object.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
reason (string): The reason (or error message) for the Exception
|
|
22
|
+
to be raised.
|
|
23
|
+
response (HttpResponse): The HttpResponse of the API call.
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
super(NotFoundException, self).__init__(reason, response)
|
|
27
|
+
dictionary = APIHelper.json_deserialize(self.response.text)
|
|
28
|
+
if isinstance(dictionary, dict):
|
|
29
|
+
self.unbox(dictionary)
|
|
30
|
+
|
|
31
|
+
def unbox(self, dictionary):
|
|
32
|
+
"""Populate the properties of this object by extracting them from a dictionary.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
dictionary (dictionary): A dictionary representation of the object as
|
|
36
|
+
obtained from the deserialization of the server's response. The keys
|
|
37
|
+
MUST match property names in the API description.
|
|
38
|
+
|
|
39
|
+
"""
|
|
40
|
+
self.error =\
|
|
41
|
+
ErrorObject.from_dictionary(
|
|
42
|
+
dictionary.get("error"))\
|
|
43
|
+
if dictionary.get("error") else None
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def __str__(self):
|
|
47
|
+
"""Return a human-readable string representation."""
|
|
48
|
+
_error=self.error
|
|
49
|
+
_base_str = super().__str__()
|
|
50
|
+
_base_str = _base_str[_base_str.find("(") + 1:-1]
|
|
51
|
+
return (
|
|
52
|
+
f"{self.__class__.__name__}("
|
|
53
|
+
f"base_str={_base_str!s}, "
|
|
54
|
+
f"error={_error!s}, "
|
|
55
|
+
f")"
|
|
56
|
+
)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""spotifywebapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: E501
|
|
7
|
+
from spotifywebapi.api_helper import APIHelper
|
|
8
|
+
from spotifywebapi.exceptions.api_exception import (
|
|
9
|
+
APIException,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class OAuthProviderException(APIException):
|
|
14
|
+
def __init__(self, reason, response):
|
|
15
|
+
"""Initialize OAuthProviderException object.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
reason (string): The reason (or error message) for the Exception
|
|
19
|
+
to be raised.
|
|
20
|
+
response (HttpResponse): The HttpResponse of the API call.
|
|
21
|
+
|
|
22
|
+
"""
|
|
23
|
+
super(OAuthProviderException, self).__init__(reason, response)
|
|
24
|
+
dictionary = APIHelper.json_deserialize(self.response.text)
|
|
25
|
+
if isinstance(dictionary, dict):
|
|
26
|
+
self.unbox(dictionary)
|
|
27
|
+
|
|
28
|
+
def unbox(self, dictionary):
|
|
29
|
+
"""Populate the properties of this object by extracting them from a dictionary.
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
dictionary (dictionary): A dictionary representation of the object as
|
|
33
|
+
obtained from the deserialization of the server's response. The keys
|
|
34
|
+
MUST match property names in the API description.
|
|
35
|
+
|
|
36
|
+
"""
|
|
37
|
+
self.error =\
|
|
38
|
+
dictionary.get("error")\
|
|
39
|
+
if dictionary.get("error")\
|
|
40
|
+
else None
|
|
41
|
+
self.error_description =\
|
|
42
|
+
dictionary.get("error_description")\
|
|
43
|
+
if dictionary.get("error_description")\
|
|
44
|
+
else None
|
|
45
|
+
self.error_uri =\
|
|
46
|
+
dictionary.get("error_uri")\
|
|
47
|
+
if dictionary.get("error_uri")\
|
|
48
|
+
else None
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def __str__(self):
|
|
52
|
+
"""Return a human-readable string representation."""
|
|
53
|
+
_error=self.error
|
|
54
|
+
_error_description=(
|
|
55
|
+
self.error_description
|
|
56
|
+
if hasattr(self, "error_description")
|
|
57
|
+
else None
|
|
58
|
+
)
|
|
59
|
+
_error_uri=(
|
|
60
|
+
self.error_uri
|
|
61
|
+
if hasattr(self, "error_uri")
|
|
62
|
+
else None
|
|
63
|
+
)
|
|
64
|
+
_base_str = super().__str__()
|
|
65
|
+
_base_str = _base_str[_base_str.find("(") + 1:-1]
|
|
66
|
+
return (
|
|
67
|
+
f"{self.__class__.__name__}("
|
|
68
|
+
f"base_str={_base_str!s}, "
|
|
69
|
+
f"error={_error!s}, "
|
|
70
|
+
f"error_description={_error_description!s}, "
|
|
71
|
+
f"error_uri={_error_uri!s}, "
|
|
72
|
+
f")"
|
|
73
|
+
)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""spotifywebapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: E501
|
|
7
|
+
from spotifywebapi.api_helper import APIHelper
|
|
8
|
+
from spotifywebapi.exceptions.api_exception import (
|
|
9
|
+
APIException,
|
|
10
|
+
)
|
|
11
|
+
from spotifywebapi.models.error_object import (
|
|
12
|
+
ErrorObject,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class TooManyRequestsException(APIException):
|
|
17
|
+
def __init__(self, reason, response):
|
|
18
|
+
"""Initialize TooManyRequestsException object.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
reason (string): The reason (or error message) for the Exception
|
|
22
|
+
to be raised.
|
|
23
|
+
response (HttpResponse): The HttpResponse of the API call.
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
super(TooManyRequestsException, self).__init__(reason, response)
|
|
27
|
+
dictionary = APIHelper.json_deserialize(self.response.text)
|
|
28
|
+
if isinstance(dictionary, dict):
|
|
29
|
+
self.unbox(dictionary)
|
|
30
|
+
|
|
31
|
+
def unbox(self, dictionary):
|
|
32
|
+
"""Populate the properties of this object by extracting them from a dictionary.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
dictionary (dictionary): A dictionary representation of the object as
|
|
36
|
+
obtained from the deserialization of the server's response. The keys
|
|
37
|
+
MUST match property names in the API description.
|
|
38
|
+
|
|
39
|
+
"""
|
|
40
|
+
self.error =\
|
|
41
|
+
ErrorObject.from_dictionary(
|
|
42
|
+
dictionary.get("error"))\
|
|
43
|
+
if dictionary.get("error") else None
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def __str__(self):
|
|
47
|
+
"""Return a human-readable string representation."""
|
|
48
|
+
_error=self.error
|
|
49
|
+
_base_str = super().__str__()
|
|
50
|
+
_base_str = _base_str[_base_str.find("(") + 1:-1]
|
|
51
|
+
return (
|
|
52
|
+
f"{self.__class__.__name__}("
|
|
53
|
+
f"base_str={_base_str!s}, "
|
|
54
|
+
f"error={_error!s}, "
|
|
55
|
+
f")"
|
|
56
|
+
)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""spotifywebapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: E501
|
|
7
|
+
from spotifywebapi.api_helper import APIHelper
|
|
8
|
+
from spotifywebapi.exceptions.api_exception import (
|
|
9
|
+
APIException,
|
|
10
|
+
)
|
|
11
|
+
from spotifywebapi.models.error_object import (
|
|
12
|
+
ErrorObject,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class UnauthorizedException(APIException):
|
|
17
|
+
def __init__(self, reason, response):
|
|
18
|
+
"""Initialize UnauthorizedException object.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
reason (string): The reason (or error message) for the Exception
|
|
22
|
+
to be raised.
|
|
23
|
+
response (HttpResponse): The HttpResponse of the API call.
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
super(UnauthorizedException, self).__init__(reason, response)
|
|
27
|
+
dictionary = APIHelper.json_deserialize(self.response.text)
|
|
28
|
+
if isinstance(dictionary, dict):
|
|
29
|
+
self.unbox(dictionary)
|
|
30
|
+
|
|
31
|
+
def unbox(self, dictionary):
|
|
32
|
+
"""Populate the properties of this object by extracting them from a dictionary.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
dictionary (dictionary): A dictionary representation of the object as
|
|
36
|
+
obtained from the deserialization of the server's response. The keys
|
|
37
|
+
MUST match property names in the API description.
|
|
38
|
+
|
|
39
|
+
"""
|
|
40
|
+
self.error =\
|
|
41
|
+
ErrorObject.from_dictionary(
|
|
42
|
+
dictionary.get("error"))\
|
|
43
|
+
if dictionary.get("error") else None
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def __str__(self):
|
|
47
|
+
"""Return a human-readable string representation."""
|
|
48
|
+
_error=self.error
|
|
49
|
+
_base_str = super().__str__()
|
|
50
|
+
_base_str = _base_str[_base_str.find("(") + 1:-1]
|
|
51
|
+
return (
|
|
52
|
+
f"{self.__class__.__name__}("
|
|
53
|
+
f"base_str={_base_str!s}, "
|
|
54
|
+
f"error={_error!s}, "
|
|
55
|
+
f")"
|
|
56
|
+
)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# ruff: noqa: D104 | Missing docstring in public package
|
|
2
|
+
# ruff: noqa: RUF022 | `__all__` is not sorted
|
|
3
|
+
__all__ = [
|
|
4
|
+
"auth",
|
|
5
|
+
"http_call_back",
|
|
6
|
+
"http_client_provider",
|
|
7
|
+
"http_method_enum",
|
|
8
|
+
"http_request",
|
|
9
|
+
"http_response",
|
|
10
|
+
"proxy_settings",
|
|
11
|
+
]
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
|
|
2
|
+
"""
|
|
3
|
+
spotifywebapi
|
|
4
|
+
|
|
5
|
+
This file was automatically generated by APIMATIC v3.0 (
|
|
6
|
+
https://www.apimatic.io ).
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from apimatic_core.http.response.api_response import ApiResponse as CoreApiResponse
|
|
10
|
+
from apimatic_core.http.response.http_response import HttpResponse
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ApiResponse(CoreApiResponse):
|
|
14
|
+
"""
|
|
15
|
+
Represent a processed API response returned by an SDK operation.
|
|
16
|
+
|
|
17
|
+
This class wraps the underlying HTTP response and provides convenient
|
|
18
|
+
access to the response body, headers, and any errors returned by the API.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def __init__(self, http_response, body=None, errors=None):
|
|
22
|
+
"""
|
|
23
|
+
Initialize an ApiResponse instance.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
http_response (HttpResponse): The original HTTP response.
|
|
27
|
+
body (object | None): The parsed response body.
|
|
28
|
+
errors (list[str] | None): Any errors returned by the API.
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
super().__init__(http_response, body, errors)
|
|
32
|
+
|
|
33
|
+
def __repr__(self):
|
|
34
|
+
"""
|
|
35
|
+
Return a concise string representation of the response.
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
str: A string identifying the ApiResponse instance.
|
|
39
|
+
|
|
40
|
+
"""
|
|
41
|
+
return f"<ApiResponse {self.text}>"
|
|
42
|
+
|
|
43
|
+
@classmethod
|
|
44
|
+
def create(cls, parent_instance):
|
|
45
|
+
"""
|
|
46
|
+
Create an ApiResponse instance from another response-like object.
|
|
47
|
+
|
|
48
|
+
This method is typically used to adapt an internal or intermediate
|
|
49
|
+
response object into a concrete ApiResponse instance.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
parent_instance: An object containing HTTP response data.
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
ApiResponse: A new ApiResponse instance.
|
|
56
|
+
|
|
57
|
+
"""
|
|
58
|
+
return cls(
|
|
59
|
+
HttpResponse(
|
|
60
|
+
parent_instance.status_code,
|
|
61
|
+
parent_instance.reason_phrase,
|
|
62
|
+
parent_instance.headers,
|
|
63
|
+
parent_instance.text,
|
|
64
|
+
parent_instance.request),
|
|
65
|
+
parent_instance.body,
|
|
66
|
+
parent_instance.errors,
|
|
67
|
+
)
|