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,821 @@
|
|
|
1
|
+
"""spotifywebapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: D410, E501, E101, D206
|
|
7
|
+
from apimatic_core.authentication.multiple.single_auth import (
|
|
8
|
+
Single,
|
|
9
|
+
)
|
|
10
|
+
from apimatic_core.request_builder import RequestBuilder
|
|
11
|
+
from apimatic_core.response_handler import ResponseHandler
|
|
12
|
+
from apimatic_core.types.parameter import Parameter
|
|
13
|
+
|
|
14
|
+
from spotifywebapi.api_helper import APIHelper
|
|
15
|
+
from spotifywebapi.configuration import Server
|
|
16
|
+
from spotifywebapi.controllers.base_controller import (
|
|
17
|
+
BaseController,
|
|
18
|
+
)
|
|
19
|
+
from spotifywebapi.exceptions.forbidden_exception import (
|
|
20
|
+
ForbiddenException,
|
|
21
|
+
)
|
|
22
|
+
from spotifywebapi.exceptions.too_many_requests_exception import (
|
|
23
|
+
TooManyRequestsException,
|
|
24
|
+
)
|
|
25
|
+
from spotifywebapi.exceptions.unauthorized_exception import (
|
|
26
|
+
UnauthorizedException,
|
|
27
|
+
)
|
|
28
|
+
from spotifywebapi.http.http_method_enum import (
|
|
29
|
+
HttpMethodEnum,
|
|
30
|
+
)
|
|
31
|
+
from spotifywebapi.models.audio_analysis_object import (
|
|
32
|
+
AudioAnalysisObject,
|
|
33
|
+
)
|
|
34
|
+
from spotifywebapi.models.audio_features_object import (
|
|
35
|
+
AudioFeaturesObject,
|
|
36
|
+
)
|
|
37
|
+
from spotifywebapi.models.many_audio_features import (
|
|
38
|
+
ManyAudioFeatures,
|
|
39
|
+
)
|
|
40
|
+
from spotifywebapi.models.many_tracks import (
|
|
41
|
+
ManyTracks,
|
|
42
|
+
)
|
|
43
|
+
from spotifywebapi.models.paging_saved_track_object import (
|
|
44
|
+
PagingSavedTrackObject,
|
|
45
|
+
)
|
|
46
|
+
from spotifywebapi.models.recommendations_object import (
|
|
47
|
+
RecommendationsObject,
|
|
48
|
+
)
|
|
49
|
+
from spotifywebapi.models.track_object import (
|
|
50
|
+
TrackObject,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class TracksController(BaseController):
|
|
55
|
+
"""A Controller to access Endpoints in the spotifywebapi API."""
|
|
56
|
+
|
|
57
|
+
def __init__(self, config):
|
|
58
|
+
"""Initialize TracksController object."""
|
|
59
|
+
super(TracksController, self).__init__(config)
|
|
60
|
+
|
|
61
|
+
def get_track(self,
|
|
62
|
+
id,
|
|
63
|
+
market=None):
|
|
64
|
+
"""Perform a GET request to /tracks/{id}.
|
|
65
|
+
|
|
66
|
+
Get Spotify catalog information for a single track identified by its
|
|
67
|
+
unique Spotify ID.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
id (str): The request template parameter.
|
|
71
|
+
market (str, optional): The request query parameter.
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
ApiResponse: An object with the response value as well as other useful
|
|
75
|
+
information such as status codes and headers. A track
|
|
76
|
+
|
|
77
|
+
Raises:
|
|
78
|
+
APIException: When an error occurs while fetching the data from the
|
|
79
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
80
|
+
message, and the HTTP body that was received in the request.
|
|
81
|
+
|
|
82
|
+
"""
|
|
83
|
+
return super().new_api_call_builder.request(
|
|
84
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
85
|
+
.path("/tracks/{id}")
|
|
86
|
+
.http_method(HttpMethodEnum.GET)
|
|
87
|
+
.template_param(Parameter()
|
|
88
|
+
.key("id")
|
|
89
|
+
.value(id)
|
|
90
|
+
.should_encode(True))
|
|
91
|
+
.query_param(Parameter()
|
|
92
|
+
.key("market")
|
|
93
|
+
.value(market))
|
|
94
|
+
.header_param(Parameter()
|
|
95
|
+
.key("accept")
|
|
96
|
+
.value("application/json"))
|
|
97
|
+
.auth(Single("oauth_2_0")),
|
|
98
|
+
).response(
|
|
99
|
+
ResponseHandler()
|
|
100
|
+
.deserializer(APIHelper.json_deserialize)
|
|
101
|
+
.deserialize_into(TrackObject.from_dictionary)
|
|
102
|
+
.is_api_response(True)
|
|
103
|
+
.local_error("401",
|
|
104
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
105
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
106
|
+
"\n",
|
|
107
|
+
UnauthorizedException)
|
|
108
|
+
.local_error("403",
|
|
109
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
110
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
111
|
+
ForbiddenException)
|
|
112
|
+
.local_error("429",
|
|
113
|
+
"The app has exceeded its rate limits.\n",
|
|
114
|
+
TooManyRequestsException),
|
|
115
|
+
).execute()
|
|
116
|
+
|
|
117
|
+
def get_several_tracks(self,
|
|
118
|
+
ids,
|
|
119
|
+
market=None):
|
|
120
|
+
"""Perform a GET request to /tracks.
|
|
121
|
+
|
|
122
|
+
Get Spotify catalog information for multiple tracks based on their Spotify
|
|
123
|
+
IDs.
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
ids (str): The request query parameter.
|
|
127
|
+
market (str, optional): The request query parameter.
|
|
128
|
+
|
|
129
|
+
Returns:
|
|
130
|
+
ApiResponse: An object with the response value as well as other useful
|
|
131
|
+
information such as status codes and headers. A set of tracks
|
|
132
|
+
|
|
133
|
+
Raises:
|
|
134
|
+
APIException: When an error occurs while fetching the data from the
|
|
135
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
136
|
+
message, and the HTTP body that was received in the request.
|
|
137
|
+
|
|
138
|
+
"""
|
|
139
|
+
return super().new_api_call_builder.request(
|
|
140
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
141
|
+
.path("/tracks")
|
|
142
|
+
.http_method(HttpMethodEnum.GET)
|
|
143
|
+
.query_param(Parameter()
|
|
144
|
+
.key("ids")
|
|
145
|
+
.value(ids))
|
|
146
|
+
.query_param(Parameter()
|
|
147
|
+
.key("market")
|
|
148
|
+
.value(market))
|
|
149
|
+
.header_param(Parameter()
|
|
150
|
+
.key("accept")
|
|
151
|
+
.value("application/json"))
|
|
152
|
+
.auth(Single("oauth_2_0")),
|
|
153
|
+
).response(
|
|
154
|
+
ResponseHandler()
|
|
155
|
+
.deserializer(APIHelper.json_deserialize)
|
|
156
|
+
.deserialize_into(ManyTracks.from_dictionary)
|
|
157
|
+
.is_api_response(True)
|
|
158
|
+
.local_error("401",
|
|
159
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
160
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
161
|
+
"\n",
|
|
162
|
+
UnauthorizedException)
|
|
163
|
+
.local_error("403",
|
|
164
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
165
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
166
|
+
ForbiddenException)
|
|
167
|
+
.local_error("429",
|
|
168
|
+
"The app has exceeded its rate limits.\n",
|
|
169
|
+
TooManyRequestsException),
|
|
170
|
+
).execute()
|
|
171
|
+
|
|
172
|
+
def get_users_saved_tracks(self,
|
|
173
|
+
market=None,
|
|
174
|
+
limit=20,
|
|
175
|
+
offset=0):
|
|
176
|
+
"""Perform a GET request to /me/tracks.
|
|
177
|
+
|
|
178
|
+
Get a list of the songs saved in the current Spotify user's 'Your Music'
|
|
179
|
+
library.
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
market (str, optional): The request query parameter.
|
|
183
|
+
limit (int, optional): The request query parameter. Example: 20
|
|
184
|
+
offset (int, optional): The request query parameter. Example: 0
|
|
185
|
+
|
|
186
|
+
Returns:
|
|
187
|
+
ApiResponse: An object with the response value as well as other useful
|
|
188
|
+
information such as status codes and headers. Pages of tracks
|
|
189
|
+
|
|
190
|
+
Raises:
|
|
191
|
+
APIException: When an error occurs while fetching the data from the
|
|
192
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
193
|
+
message, and the HTTP body that was received in the request.
|
|
194
|
+
|
|
195
|
+
"""
|
|
196
|
+
return super().new_api_call_builder.request(
|
|
197
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
198
|
+
.path("/me/tracks")
|
|
199
|
+
.http_method(HttpMethodEnum.GET)
|
|
200
|
+
.query_param(Parameter()
|
|
201
|
+
.key("market")
|
|
202
|
+
.value(market))
|
|
203
|
+
.query_param(Parameter()
|
|
204
|
+
.key("limit")
|
|
205
|
+
.value(limit))
|
|
206
|
+
.query_param(Parameter()
|
|
207
|
+
.key("offset")
|
|
208
|
+
.value(offset))
|
|
209
|
+
.header_param(Parameter()
|
|
210
|
+
.key("accept")
|
|
211
|
+
.value("application/json"))
|
|
212
|
+
.auth(Single("oauth_2_0")),
|
|
213
|
+
).response(
|
|
214
|
+
ResponseHandler()
|
|
215
|
+
.deserializer(APIHelper.json_deserialize)
|
|
216
|
+
.deserialize_into(PagingSavedTrackObject.from_dictionary)
|
|
217
|
+
.is_api_response(True)
|
|
218
|
+
.local_error("401",
|
|
219
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
220
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
221
|
+
"\n",
|
|
222
|
+
UnauthorizedException)
|
|
223
|
+
.local_error("403",
|
|
224
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
225
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
226
|
+
ForbiddenException)
|
|
227
|
+
.local_error("429",
|
|
228
|
+
"The app has exceeded its rate limits.\n",
|
|
229
|
+
TooManyRequestsException),
|
|
230
|
+
).execute()
|
|
231
|
+
|
|
232
|
+
def save_tracks_user(self,
|
|
233
|
+
ids,
|
|
234
|
+
body=None):
|
|
235
|
+
"""Perform a PUT request to /me/tracks.
|
|
236
|
+
|
|
237
|
+
Save one or more tracks to the current user's 'Your Music' library.
|
|
238
|
+
|
|
239
|
+
Args:
|
|
240
|
+
ids (str): The request query parameter.
|
|
241
|
+
body (MeTracksRequest, optional): The request body parameter.
|
|
242
|
+
|
|
243
|
+
Returns:
|
|
244
|
+
ApiResponse: An object with the response value as well as other useful
|
|
245
|
+
information such as status codes and headers. Track saved
|
|
246
|
+
|
|
247
|
+
Raises:
|
|
248
|
+
APIException: When an error occurs while fetching the data from the
|
|
249
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
250
|
+
message, and the HTTP body that was received in the request.
|
|
251
|
+
|
|
252
|
+
"""
|
|
253
|
+
return super().new_api_call_builder.request(
|
|
254
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
255
|
+
.path("/me/tracks")
|
|
256
|
+
.http_method(HttpMethodEnum.PUT)
|
|
257
|
+
.query_param(Parameter()
|
|
258
|
+
.key("ids")
|
|
259
|
+
.value(ids))
|
|
260
|
+
.header_param(Parameter()
|
|
261
|
+
.key("Content-Type")
|
|
262
|
+
.value("application/json"))
|
|
263
|
+
.body_param(Parameter()
|
|
264
|
+
.value(body))
|
|
265
|
+
.body_serializer(APIHelper.json_serialize)
|
|
266
|
+
.auth(Single("oauth_2_0")),
|
|
267
|
+
).response(
|
|
268
|
+
ResponseHandler()
|
|
269
|
+
.is_api_response(True)
|
|
270
|
+
.local_error("401",
|
|
271
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
272
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
273
|
+
"\n",
|
|
274
|
+
UnauthorizedException)
|
|
275
|
+
.local_error("403",
|
|
276
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
277
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
278
|
+
ForbiddenException)
|
|
279
|
+
.local_error("429",
|
|
280
|
+
"The app has exceeded its rate limits.\n",
|
|
281
|
+
TooManyRequestsException),
|
|
282
|
+
).execute()
|
|
283
|
+
|
|
284
|
+
def remove_tracks_user(self,
|
|
285
|
+
ids,
|
|
286
|
+
body=None):
|
|
287
|
+
"""Perform a DELETE request to /me/tracks.
|
|
288
|
+
|
|
289
|
+
Remove one or more tracks from the current user's 'Your Music' library.
|
|
290
|
+
|
|
291
|
+
Args:
|
|
292
|
+
ids (str): The request query parameter.
|
|
293
|
+
body (MeTracksRequest1, optional): The request body parameter.
|
|
294
|
+
|
|
295
|
+
Returns:
|
|
296
|
+
ApiResponse: An object with the response value as well as other useful
|
|
297
|
+
information such as status codes and headers. Track removed
|
|
298
|
+
|
|
299
|
+
Raises:
|
|
300
|
+
APIException: When an error occurs while fetching the data from the
|
|
301
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
302
|
+
message, and the HTTP body that was received in the request.
|
|
303
|
+
|
|
304
|
+
"""
|
|
305
|
+
return super().new_api_call_builder.request(
|
|
306
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
307
|
+
.path("/me/tracks")
|
|
308
|
+
.http_method(HttpMethodEnum.DELETE)
|
|
309
|
+
.query_param(Parameter()
|
|
310
|
+
.key("ids")
|
|
311
|
+
.value(ids))
|
|
312
|
+
.header_param(Parameter()
|
|
313
|
+
.key("Content-Type")
|
|
314
|
+
.value("application/json"))
|
|
315
|
+
.body_param(Parameter()
|
|
316
|
+
.value(body))
|
|
317
|
+
.body_serializer(APIHelper.json_serialize)
|
|
318
|
+
.auth(Single("oauth_2_0")),
|
|
319
|
+
).response(
|
|
320
|
+
ResponseHandler()
|
|
321
|
+
.is_api_response(True)
|
|
322
|
+
.local_error("401",
|
|
323
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
324
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
325
|
+
"\n",
|
|
326
|
+
UnauthorizedException)
|
|
327
|
+
.local_error("403",
|
|
328
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
329
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
330
|
+
ForbiddenException)
|
|
331
|
+
.local_error("429",
|
|
332
|
+
"The app has exceeded its rate limits.\n",
|
|
333
|
+
TooManyRequestsException),
|
|
334
|
+
).execute()
|
|
335
|
+
|
|
336
|
+
def check_users_saved_tracks(self,
|
|
337
|
+
ids):
|
|
338
|
+
"""Perform a GET request to /me/tracks/contains.
|
|
339
|
+
|
|
340
|
+
Check if one or more tracks is already saved in the current Spotify user's
|
|
341
|
+
'Your Music' library.
|
|
342
|
+
|
|
343
|
+
Args:
|
|
344
|
+
ids (str): The request query parameter.
|
|
345
|
+
|
|
346
|
+
Returns:
|
|
347
|
+
ApiResponse: An object with the response value as well as other useful
|
|
348
|
+
information such as status codes and headers. Array of booleans
|
|
349
|
+
|
|
350
|
+
Raises:
|
|
351
|
+
APIException: When an error occurs while fetching the data from the
|
|
352
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
353
|
+
message, and the HTTP body that was received in the request.
|
|
354
|
+
|
|
355
|
+
"""
|
|
356
|
+
return super().new_api_call_builder.request(
|
|
357
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
358
|
+
.path("/me/tracks/contains")
|
|
359
|
+
.http_method(HttpMethodEnum.GET)
|
|
360
|
+
.query_param(Parameter()
|
|
361
|
+
.key("ids")
|
|
362
|
+
.value(ids))
|
|
363
|
+
.header_param(Parameter()
|
|
364
|
+
.key("accept")
|
|
365
|
+
.value("application/json"))
|
|
366
|
+
.auth(Single("oauth_2_0")),
|
|
367
|
+
).response(
|
|
368
|
+
ResponseHandler()
|
|
369
|
+
.deserializer(APIHelper.json_deserialize)
|
|
370
|
+
.is_api_response(True)
|
|
371
|
+
.local_error("401",
|
|
372
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
373
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
374
|
+
"\n",
|
|
375
|
+
UnauthorizedException)
|
|
376
|
+
.local_error("403",
|
|
377
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
378
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
379
|
+
ForbiddenException)
|
|
380
|
+
.local_error("429",
|
|
381
|
+
"The app has exceeded its rate limits.\n",
|
|
382
|
+
TooManyRequestsException),
|
|
383
|
+
).execute()
|
|
384
|
+
|
|
385
|
+
def get_several_audio_features(self,
|
|
386
|
+
ids):
|
|
387
|
+
"""Perform a GET request to /audio-features.
|
|
388
|
+
|
|
389
|
+
Get audio features for multiple tracks based on their Spotify IDs.
|
|
390
|
+
|
|
391
|
+
Args:
|
|
392
|
+
ids (str): The request query parameter.
|
|
393
|
+
|
|
394
|
+
Returns:
|
|
395
|
+
ApiResponse: An object with the response value as well as other useful
|
|
396
|
+
information such as status codes and headers. A set of audio features
|
|
397
|
+
|
|
398
|
+
Raises:
|
|
399
|
+
APIException: When an error occurs while fetching the data from the
|
|
400
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
401
|
+
message, and the HTTP body that was received in the request.
|
|
402
|
+
|
|
403
|
+
"""
|
|
404
|
+
return super().new_api_call_builder.request(
|
|
405
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
406
|
+
.path("/audio-features")
|
|
407
|
+
.http_method(HttpMethodEnum.GET)
|
|
408
|
+
.query_param(Parameter()
|
|
409
|
+
.key("ids")
|
|
410
|
+
.value(ids))
|
|
411
|
+
.header_param(Parameter()
|
|
412
|
+
.key("accept")
|
|
413
|
+
.value("application/json"))
|
|
414
|
+
.auth(Single("oauth_2_0")),
|
|
415
|
+
).response(
|
|
416
|
+
ResponseHandler()
|
|
417
|
+
.deserializer(APIHelper.json_deserialize)
|
|
418
|
+
.deserialize_into(ManyAudioFeatures.from_dictionary)
|
|
419
|
+
.is_api_response(True)
|
|
420
|
+
.local_error("401",
|
|
421
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
422
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
423
|
+
"\n",
|
|
424
|
+
UnauthorizedException)
|
|
425
|
+
.local_error("403",
|
|
426
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
427
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
428
|
+
ForbiddenException)
|
|
429
|
+
.local_error("429",
|
|
430
|
+
"The app has exceeded its rate limits.\n",
|
|
431
|
+
TooManyRequestsException),
|
|
432
|
+
).execute()
|
|
433
|
+
|
|
434
|
+
def get_audio_features(self,
|
|
435
|
+
id):
|
|
436
|
+
"""Perform a GET request to /audio-features/{id}.
|
|
437
|
+
|
|
438
|
+
Get audio feature information for a single track identified by its unique
|
|
439
|
+
Spotify ID.
|
|
440
|
+
|
|
441
|
+
Args:
|
|
442
|
+
id (str): The request template parameter.
|
|
443
|
+
|
|
444
|
+
Returns:
|
|
445
|
+
ApiResponse: An object with the response value as well as other useful
|
|
446
|
+
information such as status codes and headers. Audio features for one
|
|
447
|
+
track
|
|
448
|
+
|
|
449
|
+
Raises:
|
|
450
|
+
APIException: When an error occurs while fetching the data from the
|
|
451
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
452
|
+
message, and the HTTP body that was received in the request.
|
|
453
|
+
|
|
454
|
+
"""
|
|
455
|
+
return super().new_api_call_builder.request(
|
|
456
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
457
|
+
.path("/audio-features/{id}")
|
|
458
|
+
.http_method(HttpMethodEnum.GET)
|
|
459
|
+
.template_param(Parameter()
|
|
460
|
+
.key("id")
|
|
461
|
+
.value(id)
|
|
462
|
+
.should_encode(True))
|
|
463
|
+
.header_param(Parameter()
|
|
464
|
+
.key("accept")
|
|
465
|
+
.value("application/json"))
|
|
466
|
+
.auth(Single("oauth_2_0")),
|
|
467
|
+
).response(
|
|
468
|
+
ResponseHandler()
|
|
469
|
+
.deserializer(APIHelper.json_deserialize)
|
|
470
|
+
.deserialize_into(AudioFeaturesObject.from_dictionary)
|
|
471
|
+
.is_api_response(True)
|
|
472
|
+
.local_error("401",
|
|
473
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
474
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
475
|
+
"\n",
|
|
476
|
+
UnauthorizedException)
|
|
477
|
+
.local_error("403",
|
|
478
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
479
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
480
|
+
ForbiddenException)
|
|
481
|
+
.local_error("429",
|
|
482
|
+
"The app has exceeded its rate limits.\n",
|
|
483
|
+
TooManyRequestsException),
|
|
484
|
+
).execute()
|
|
485
|
+
|
|
486
|
+
def get_audio_analysis(self,
|
|
487
|
+
id):
|
|
488
|
+
"""Perform a GET request to /audio-analysis/{id}.
|
|
489
|
+
|
|
490
|
+
Get a low-level audio analysis for a track in the Spotify catalog. The audio
|
|
491
|
+
analysis describes the track’s structure and musical content, including
|
|
492
|
+
rhythm, pitch, and timbre.
|
|
493
|
+
|
|
494
|
+
Args:
|
|
495
|
+
id (str): The request template parameter.
|
|
496
|
+
|
|
497
|
+
Returns:
|
|
498
|
+
ApiResponse: An object with the response value as well as other useful
|
|
499
|
+
information such as status codes and headers. Audio analysis for one
|
|
500
|
+
track
|
|
501
|
+
|
|
502
|
+
Raises:
|
|
503
|
+
APIException: When an error occurs while fetching the data from the
|
|
504
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
505
|
+
message, and the HTTP body that was received in the request.
|
|
506
|
+
|
|
507
|
+
"""
|
|
508
|
+
return super().new_api_call_builder.request(
|
|
509
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
510
|
+
.path("/audio-analysis/{id}")
|
|
511
|
+
.http_method(HttpMethodEnum.GET)
|
|
512
|
+
.template_param(Parameter()
|
|
513
|
+
.key("id")
|
|
514
|
+
.value(id)
|
|
515
|
+
.should_encode(True))
|
|
516
|
+
.header_param(Parameter()
|
|
517
|
+
.key("accept")
|
|
518
|
+
.value("application/json"))
|
|
519
|
+
.auth(Single("oauth_2_0")),
|
|
520
|
+
).response(
|
|
521
|
+
ResponseHandler()
|
|
522
|
+
.deserializer(APIHelper.json_deserialize)
|
|
523
|
+
.deserialize_into(AudioAnalysisObject.from_dictionary)
|
|
524
|
+
.is_api_response(True)
|
|
525
|
+
.local_error("401",
|
|
526
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
527
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
528
|
+
"\n",
|
|
529
|
+
UnauthorizedException)
|
|
530
|
+
.local_error("403",
|
|
531
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
532
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
533
|
+
ForbiddenException)
|
|
534
|
+
.local_error("429",
|
|
535
|
+
"The app has exceeded its rate limits.\n",
|
|
536
|
+
TooManyRequestsException),
|
|
537
|
+
).execute()
|
|
538
|
+
|
|
539
|
+
def get_recommendations(self,
|
|
540
|
+
limit=20,
|
|
541
|
+
market=None,
|
|
542
|
+
seed_artists=None,
|
|
543
|
+
seed_genres=None,
|
|
544
|
+
seed_tracks=None,
|
|
545
|
+
min_acousticness=None,
|
|
546
|
+
max_acousticness=None,
|
|
547
|
+
target_acousticness=None,
|
|
548
|
+
min_danceability=None,
|
|
549
|
+
max_danceability=None,
|
|
550
|
+
target_danceability=None,
|
|
551
|
+
min_duration_ms=None,
|
|
552
|
+
max_duration_ms=None,
|
|
553
|
+
target_duration_ms=None,
|
|
554
|
+
min_energy=None,
|
|
555
|
+
max_energy=None,
|
|
556
|
+
target_energy=None,
|
|
557
|
+
min_instrumentalness=None,
|
|
558
|
+
max_instrumentalness=None,
|
|
559
|
+
target_instrumentalness=None,
|
|
560
|
+
min_key=None,
|
|
561
|
+
max_key=None,
|
|
562
|
+
target_key=None,
|
|
563
|
+
min_liveness=None,
|
|
564
|
+
max_liveness=None,
|
|
565
|
+
target_liveness=None,
|
|
566
|
+
min_loudness=None,
|
|
567
|
+
max_loudness=None,
|
|
568
|
+
target_loudness=None,
|
|
569
|
+
min_mode=None,
|
|
570
|
+
max_mode=None,
|
|
571
|
+
target_mode=None,
|
|
572
|
+
min_popularity=None,
|
|
573
|
+
max_popularity=None,
|
|
574
|
+
target_popularity=None,
|
|
575
|
+
min_speechiness=None,
|
|
576
|
+
max_speechiness=None,
|
|
577
|
+
target_speechiness=None,
|
|
578
|
+
min_tempo=None,
|
|
579
|
+
max_tempo=None,
|
|
580
|
+
target_tempo=None,
|
|
581
|
+
min_time_signature=None,
|
|
582
|
+
max_time_signature=None,
|
|
583
|
+
target_time_signature=None,
|
|
584
|
+
min_valence=None,
|
|
585
|
+
max_valence=None,
|
|
586
|
+
target_valence=None):
|
|
587
|
+
"""Perform a GET request to /recommendations.
|
|
588
|
+
|
|
589
|
+
Recommendations are generated based on the available information for a given
|
|
590
|
+
seed entity and matched against similar artists and tracks. If there is
|
|
591
|
+
sufficient information about the provided seeds, a list of tracks will be
|
|
592
|
+
returned together with pool size details.
|
|
593
|
+
For artists and tracks that are very new or obscure there might not be enough
|
|
594
|
+
data to generate a list of tracks.
|
|
595
|
+
|
|
596
|
+
Args:
|
|
597
|
+
limit (int, optional): The request query parameter. Example: 20
|
|
598
|
+
market (str, optional): The request query parameter.
|
|
599
|
+
seed_artists (str, optional): The request query parameter.
|
|
600
|
+
seed_genres (str, optional): The request query parameter.
|
|
601
|
+
seed_tracks (str, optional): The request query parameter.
|
|
602
|
+
min_acousticness (float, optional): The request query parameter.
|
|
603
|
+
max_acousticness (float, optional): The request query parameter.
|
|
604
|
+
target_acousticness (float, optional): The request query parameter.
|
|
605
|
+
min_danceability (float, optional): The request query parameter.
|
|
606
|
+
max_danceability (float, optional): The request query parameter.
|
|
607
|
+
target_danceability (float, optional): The request query parameter.
|
|
608
|
+
min_duration_ms (int, optional): The request query parameter.
|
|
609
|
+
max_duration_ms (int, optional): The request query parameter.
|
|
610
|
+
target_duration_ms (int, optional): The request query parameter.
|
|
611
|
+
min_energy (float, optional): The request query parameter.
|
|
612
|
+
max_energy (float, optional): The request query parameter.
|
|
613
|
+
target_energy (float, optional): The request query parameter.
|
|
614
|
+
min_instrumentalness (float, optional): The request query parameter.
|
|
615
|
+
max_instrumentalness (float, optional): The request query parameter.
|
|
616
|
+
target_instrumentalness (float, optional): The request query parameter.
|
|
617
|
+
min_key (int, optional): The request query parameter.
|
|
618
|
+
max_key (int, optional): The request query parameter.
|
|
619
|
+
target_key (int, optional): The request query parameter.
|
|
620
|
+
min_liveness (float, optional): The request query parameter.
|
|
621
|
+
max_liveness (float, optional): The request query parameter.
|
|
622
|
+
target_liveness (float, optional): The request query parameter.
|
|
623
|
+
min_loudness (float, optional): The request query parameter.
|
|
624
|
+
max_loudness (float, optional): The request query parameter.
|
|
625
|
+
target_loudness (float, optional): The request query parameter.
|
|
626
|
+
min_mode (int, optional): The request query parameter.
|
|
627
|
+
max_mode (int, optional): The request query parameter.
|
|
628
|
+
target_mode (int, optional): The request query parameter.
|
|
629
|
+
min_popularity (int, optional): The request query parameter.
|
|
630
|
+
max_popularity (int, optional): The request query parameter.
|
|
631
|
+
target_popularity (int, optional): The request query parameter.
|
|
632
|
+
min_speechiness (float, optional): The request query parameter.
|
|
633
|
+
max_speechiness (float, optional): The request query parameter.
|
|
634
|
+
target_speechiness (float, optional): The request query parameter.
|
|
635
|
+
min_tempo (float, optional): The request query parameter.
|
|
636
|
+
max_tempo (float, optional): The request query parameter.
|
|
637
|
+
target_tempo (float, optional): The request query parameter.
|
|
638
|
+
min_time_signature (int, optional): The request query parameter.
|
|
639
|
+
max_time_signature (int, optional): The request query parameter.
|
|
640
|
+
target_time_signature (int, optional): The request query parameter.
|
|
641
|
+
min_valence (float, optional): The request query parameter.
|
|
642
|
+
max_valence (float, optional): The request query parameter.
|
|
643
|
+
target_valence (float, optional): The request query parameter.
|
|
644
|
+
|
|
645
|
+
Returns:
|
|
646
|
+
ApiResponse: An object with the response value as well as other useful
|
|
647
|
+
information such as status codes and headers. A set of recommendations
|
|
648
|
+
|
|
649
|
+
Raises:
|
|
650
|
+
APIException: When an error occurs while fetching the data from the
|
|
651
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
652
|
+
message, and the HTTP body that was received in the request.
|
|
653
|
+
|
|
654
|
+
"""
|
|
655
|
+
return super().new_api_call_builder.request(
|
|
656
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
657
|
+
.path("/recommendations")
|
|
658
|
+
.http_method(HttpMethodEnum.GET)
|
|
659
|
+
.query_param(Parameter()
|
|
660
|
+
.key("limit")
|
|
661
|
+
.value(limit))
|
|
662
|
+
.query_param(Parameter()
|
|
663
|
+
.key("market")
|
|
664
|
+
.value(market))
|
|
665
|
+
.query_param(Parameter()
|
|
666
|
+
.key("seed_artists")
|
|
667
|
+
.value(seed_artists))
|
|
668
|
+
.query_param(Parameter()
|
|
669
|
+
.key("seed_genres")
|
|
670
|
+
.value(seed_genres))
|
|
671
|
+
.query_param(Parameter()
|
|
672
|
+
.key("seed_tracks")
|
|
673
|
+
.value(seed_tracks))
|
|
674
|
+
.query_param(Parameter()
|
|
675
|
+
.key("min_acousticness")
|
|
676
|
+
.value(min_acousticness))
|
|
677
|
+
.query_param(Parameter()
|
|
678
|
+
.key("max_acousticness")
|
|
679
|
+
.value(max_acousticness))
|
|
680
|
+
.query_param(Parameter()
|
|
681
|
+
.key("target_acousticness")
|
|
682
|
+
.value(target_acousticness))
|
|
683
|
+
.query_param(Parameter()
|
|
684
|
+
.key("min_danceability")
|
|
685
|
+
.value(min_danceability))
|
|
686
|
+
.query_param(Parameter()
|
|
687
|
+
.key("max_danceability")
|
|
688
|
+
.value(max_danceability))
|
|
689
|
+
.query_param(Parameter()
|
|
690
|
+
.key("target_danceability")
|
|
691
|
+
.value(target_danceability))
|
|
692
|
+
.query_param(Parameter()
|
|
693
|
+
.key("min_duration_ms")
|
|
694
|
+
.value(min_duration_ms))
|
|
695
|
+
.query_param(Parameter()
|
|
696
|
+
.key("max_duration_ms")
|
|
697
|
+
.value(max_duration_ms))
|
|
698
|
+
.query_param(Parameter()
|
|
699
|
+
.key("target_duration_ms")
|
|
700
|
+
.value(target_duration_ms))
|
|
701
|
+
.query_param(Parameter()
|
|
702
|
+
.key("min_energy")
|
|
703
|
+
.value(min_energy))
|
|
704
|
+
.query_param(Parameter()
|
|
705
|
+
.key("max_energy")
|
|
706
|
+
.value(max_energy))
|
|
707
|
+
.query_param(Parameter()
|
|
708
|
+
.key("target_energy")
|
|
709
|
+
.value(target_energy))
|
|
710
|
+
.query_param(Parameter()
|
|
711
|
+
.key("min_instrumentalness")
|
|
712
|
+
.value(min_instrumentalness))
|
|
713
|
+
.query_param(Parameter()
|
|
714
|
+
.key("max_instrumentalness")
|
|
715
|
+
.value(max_instrumentalness))
|
|
716
|
+
.query_param(Parameter()
|
|
717
|
+
.key("target_instrumentalness")
|
|
718
|
+
.value(target_instrumentalness))
|
|
719
|
+
.query_param(Parameter()
|
|
720
|
+
.key("min_key")
|
|
721
|
+
.value(min_key))
|
|
722
|
+
.query_param(Parameter()
|
|
723
|
+
.key("max_key")
|
|
724
|
+
.value(max_key))
|
|
725
|
+
.query_param(Parameter()
|
|
726
|
+
.key("target_key")
|
|
727
|
+
.value(target_key))
|
|
728
|
+
.query_param(Parameter()
|
|
729
|
+
.key("min_liveness")
|
|
730
|
+
.value(min_liveness))
|
|
731
|
+
.query_param(Parameter()
|
|
732
|
+
.key("max_liveness")
|
|
733
|
+
.value(max_liveness))
|
|
734
|
+
.query_param(Parameter()
|
|
735
|
+
.key("target_liveness")
|
|
736
|
+
.value(target_liveness))
|
|
737
|
+
.query_param(Parameter()
|
|
738
|
+
.key("min_loudness")
|
|
739
|
+
.value(min_loudness))
|
|
740
|
+
.query_param(Parameter()
|
|
741
|
+
.key("max_loudness")
|
|
742
|
+
.value(max_loudness))
|
|
743
|
+
.query_param(Parameter()
|
|
744
|
+
.key("target_loudness")
|
|
745
|
+
.value(target_loudness))
|
|
746
|
+
.query_param(Parameter()
|
|
747
|
+
.key("min_mode")
|
|
748
|
+
.value(min_mode))
|
|
749
|
+
.query_param(Parameter()
|
|
750
|
+
.key("max_mode")
|
|
751
|
+
.value(max_mode))
|
|
752
|
+
.query_param(Parameter()
|
|
753
|
+
.key("target_mode")
|
|
754
|
+
.value(target_mode))
|
|
755
|
+
.query_param(Parameter()
|
|
756
|
+
.key("min_popularity")
|
|
757
|
+
.value(min_popularity))
|
|
758
|
+
.query_param(Parameter()
|
|
759
|
+
.key("max_popularity")
|
|
760
|
+
.value(max_popularity))
|
|
761
|
+
.query_param(Parameter()
|
|
762
|
+
.key("target_popularity")
|
|
763
|
+
.value(target_popularity))
|
|
764
|
+
.query_param(Parameter()
|
|
765
|
+
.key("min_speechiness")
|
|
766
|
+
.value(min_speechiness))
|
|
767
|
+
.query_param(Parameter()
|
|
768
|
+
.key("max_speechiness")
|
|
769
|
+
.value(max_speechiness))
|
|
770
|
+
.query_param(Parameter()
|
|
771
|
+
.key("target_speechiness")
|
|
772
|
+
.value(target_speechiness))
|
|
773
|
+
.query_param(Parameter()
|
|
774
|
+
.key("min_tempo")
|
|
775
|
+
.value(min_tempo))
|
|
776
|
+
.query_param(Parameter()
|
|
777
|
+
.key("max_tempo")
|
|
778
|
+
.value(max_tempo))
|
|
779
|
+
.query_param(Parameter()
|
|
780
|
+
.key("target_tempo")
|
|
781
|
+
.value(target_tempo))
|
|
782
|
+
.query_param(Parameter()
|
|
783
|
+
.key("min_time_signature")
|
|
784
|
+
.value(min_time_signature))
|
|
785
|
+
.query_param(Parameter()
|
|
786
|
+
.key("max_time_signature")
|
|
787
|
+
.value(max_time_signature))
|
|
788
|
+
.query_param(Parameter()
|
|
789
|
+
.key("target_time_signature")
|
|
790
|
+
.value(target_time_signature))
|
|
791
|
+
.query_param(Parameter()
|
|
792
|
+
.key("min_valence")
|
|
793
|
+
.value(min_valence))
|
|
794
|
+
.query_param(Parameter()
|
|
795
|
+
.key("max_valence")
|
|
796
|
+
.value(max_valence))
|
|
797
|
+
.query_param(Parameter()
|
|
798
|
+
.key("target_valence")
|
|
799
|
+
.value(target_valence))
|
|
800
|
+
.header_param(Parameter()
|
|
801
|
+
.key("accept")
|
|
802
|
+
.value("application/json"))
|
|
803
|
+
.auth(Single("oauth_2_0")),
|
|
804
|
+
).response(
|
|
805
|
+
ResponseHandler()
|
|
806
|
+
.deserializer(APIHelper.json_deserialize)
|
|
807
|
+
.deserialize_into(RecommendationsObject.from_dictionary)
|
|
808
|
+
.is_api_response(True)
|
|
809
|
+
.local_error("401",
|
|
810
|
+
"Bad or expired token. This can happen if the user revoked a token or"
|
|
811
|
+
"\nthe access token has expired. You should re-authenticate the user."
|
|
812
|
+
"\n",
|
|
813
|
+
UnauthorizedException)
|
|
814
|
+
.local_error("403",
|
|
815
|
+
"Bad OAuth request (wrong consumer key, bad nonce, expired\ntimestamp"
|
|
816
|
+
"...). Unfortunately, re-authenticating the user won't help here.\n",
|
|
817
|
+
ForbiddenException)
|
|
818
|
+
.local_error("429",
|
|
819
|
+
"The app has exceeded its rate limits.\n",
|
|
820
|
+
TooManyRequestsException),
|
|
821
|
+
).execute()
|