spotifywebapiPython 1.0.17__py3-none-any.whl → 1.0.19__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.

Potentially problematic release.


This version of spotifywebapiPython might be problematic. Click here for more details.

Files changed (41) hide show
  1. {spotifywebapiPython-1.0.17.dist-info → spotifywebapiPython-1.0.19.dist-info}/METADATA +1 -1
  2. {spotifywebapiPython-1.0.17.dist-info → spotifywebapiPython-1.0.19.dist-info}/RECORD +41 -41
  3. spotifywebapipython/const.py +1 -1
  4. spotifywebapipython/docs/__init__.html +24 -2
  5. spotifywebapipython/docs/index.html +2 -2
  6. spotifywebapipython/docs/search.js +1 -1
  7. spotifywebapipython/docs/spotifywebapiPython/const.html +3 -3
  8. spotifywebapipython/docs/spotifywebapiPython/saappmessages.html +2 -2
  9. spotifywebapipython/docs/spotifywebapiPython/sautils.html +2 -2
  10. spotifywebapipython/docs/spotifywebapiPython/spotifyapierror.html +2 -2
  11. spotifywebapipython/docs/spotifywebapiPython/spotifyapimessage.html +2 -2
  12. spotifywebapipython/docs/spotifywebapiPython/spotifyauthtoken.html +37 -21
  13. spotifywebapipython/docs/spotifywebapiPython/spotifyclient.html +4 -4
  14. spotifywebapipython/docs/spotifywebapiPython/spotifywebapiauthenticationerror.html +2 -2
  15. spotifywebapipython/docs/spotifywebapiPython/spotifywebapierror.html +2 -2
  16. spotifywebapipython/models/albumpagesaved.py +15 -0
  17. spotifywebapipython/models/albumsimplified.py +13 -2
  18. spotifywebapipython/models/artist.py +11 -0
  19. spotifywebapipython/models/artistsimplified.py +2 -2
  20. spotifywebapipython/models/audiobooksimplified.py +13 -4
  21. spotifywebapipython/models/category.py +13 -2
  22. spotifywebapipython/models/chaptersimplified.py +13 -2
  23. spotifywebapipython/models/episodepagesaved.py +15 -0
  24. spotifywebapipython/models/episodesimplified.py +13 -2
  25. spotifywebapipython/models/playlist.py +14 -0
  26. spotifywebapipython/models/playlistpage.py +15 -0
  27. spotifywebapipython/models/playlistsimplified.py +13 -2
  28. spotifywebapipython/models/playlisttrack.py +12 -0
  29. spotifywebapipython/models/showpagesaved.py +15 -0
  30. spotifywebapipython/models/showsimplified.py +13 -2
  31. spotifywebapipython/models/track.py +11 -0
  32. spotifywebapipython/models/trackpagesaved.py +15 -0
  33. spotifywebapipython/models/trackrecommendations.py +5 -5
  34. spotifywebapipython/models/tracksaved.py +4 -4
  35. spotifywebapipython/models/tracksimplified.py +12 -2
  36. spotifywebapipython/models/userprofilesimplified.py +11 -0
  37. spotifywebapipython/spotifyauthtoken.py +19 -11
  38. spotifywebapipython/spotifyclient.py +107 -102
  39. {spotifywebapiPython-1.0.17.dist-info → spotifywebapiPython-1.0.19.dist-info}/LICENSE +0 -0
  40. {spotifywebapiPython-1.0.17.dist-info → spotifywebapiPython-1.0.19.dist-info}/WHEEL +0 -0
  41. {spotifywebapiPython-1.0.17.dist-info → spotifywebapiPython-1.0.19.dist-info}/top_level.txt +0 -0
@@ -96,7 +96,7 @@ class ChapterSimplified:
96
96
  def __eq__(self, other):
97
97
  try:
98
98
  return self.Name == other.Name
99
- except Exception as ex:
99
+ except Exception:
100
100
  if (isinstance(self, ChapterSimplified )) and (isinstance(other, ChapterSimplified )):
101
101
  return self.Name == other.Name
102
102
  return False
@@ -104,7 +104,7 @@ class ChapterSimplified:
104
104
  def __lt__(self, other):
105
105
  try:
106
106
  return self.Name < other.Name
107
- except Exception as ex:
107
+ except Exception:
108
108
  if (isinstance(self, ChapterSimplified )) and (isinstance(other, ChapterSimplified )):
109
109
  return self.Name < other.Name
110
110
  return False
@@ -216,6 +216,17 @@ class ChapterSimplified:
216
216
  return self._Images
217
217
 
218
218
 
219
+ @property
220
+ def ImageUrl(self) -> str:
221
+ """
222
+ Gets the first image url in the `Images` list, if images are defined;
223
+ otherwise, null.
224
+ """
225
+ if len(self._Images) > 0:
226
+ return self._Images[0].Url
227
+ return None
228
+
229
+
219
230
  @property
220
231
  def IsPlayable(self) -> bool:
221
232
  """
@@ -2,6 +2,7 @@
2
2
 
3
3
  # our package imports.
4
4
  from ..sautils import export
5
+ from .episode import Episode
5
6
  from .episodesaved import EpisodeSaved
6
7
  from .pageobject import PageObject
7
8
 
@@ -56,6 +57,20 @@ class EpisodePageSaved(PageObject):
56
57
  return self._Items
57
58
 
58
59
 
60
+ def GetEpisodes(self) -> list[Episode]:
61
+ """
62
+ Gets a list of all episodes contained in the underlying `Items` list.
63
+
64
+ This is a convenience method so one does not have to loop through the `Items`
65
+ array of EpisodeSaved objects to get the list of episodes.
66
+ """
67
+ result:list[Episode] = []
68
+ item:EpisodeSaved
69
+ for item in self._Items:
70
+ result.append(item.Episode)
71
+ return result
72
+
73
+
59
74
  def ToString(self, includeItems:bool=False) -> str:
60
75
  """
61
76
  Returns a displayable string representation of the class.
@@ -94,7 +94,7 @@ class EpisodeSimplified:
94
94
  def __eq__(self, other):
95
95
  try:
96
96
  return self.Name == other.Name
97
- except Exception as ex:
97
+ except Exception:
98
98
  if (isinstance(self, EpisodeSimplified )) and (isinstance(other, EpisodeSimplified )):
99
99
  return self.Name == other.Name
100
100
  return False
@@ -102,7 +102,7 @@ class EpisodeSimplified:
102
102
  def __lt__(self, other):
103
103
  try:
104
104
  return self.Name < other.Name
105
- except Exception as ex:
105
+ except Exception:
106
106
  if (isinstance(self, EpisodeSimplified )) and (isinstance(other, EpisodeSimplified )):
107
107
  return self.Name < other.Name
108
108
  return False
@@ -193,6 +193,17 @@ class EpisodeSimplified:
193
193
  return self._Images
194
194
 
195
195
 
196
+ @property
197
+ def ImageUrl(self) -> str:
198
+ """
199
+ Gets the first image url in the `Images` list, if images are defined;
200
+ otherwise, null.
201
+ """
202
+ if len(self._Images) > 0:
203
+ return self._Images[0].Url
204
+ return None
205
+
206
+
196
207
  @property
197
208
  def IsExternallyHosted(self) -> bool:
198
209
  """
@@ -5,6 +5,7 @@ from ..sautils import export
5
5
  from .followers import Followers
6
6
  from .playlistpage import PlaylistPage
7
7
  from .playlistsimplified import PlaylistSimplified
8
+ from .track import Track
8
9
 
9
10
  @export
10
11
  class Playlist(PlaylistSimplified):
@@ -70,6 +71,19 @@ class Playlist(PlaylistSimplified):
70
71
  return self._Tracks
71
72
 
72
73
 
74
+ def GetTracks(self) -> list[Track]:
75
+ """
76
+ Gets a list of all tracks contained in the underlying `Items` list.
77
+
78
+ This is a convenience method so one does not have to loop through the `Items`
79
+ array of TrackSaved objects to get the list of tracks.
80
+ """
81
+ result:list[Track] = []
82
+ if self._Tracks is not None:
83
+ result = self._Tracks.GetTracks()
84
+ return result
85
+
86
+
73
87
  def ToDictionary(self) -> dict:
74
88
  """
75
89
  Returns a dictionary representation of the class.
@@ -4,6 +4,7 @@
4
4
  from ..sautils import export
5
5
  from .pageobject import PageObject
6
6
  from .playlisttrack import PlaylistTrack
7
+ from .track import Track
7
8
 
8
9
  @export
9
10
  class PlaylistPage(PageObject):
@@ -56,6 +57,20 @@ class PlaylistPage(PageObject):
56
57
  return self._Items
57
58
 
58
59
 
60
+ def GetTracks(self) -> list[Track]:
61
+ """
62
+ Gets a list of all tracks contained in the underlying `Items` list.
63
+
64
+ This is a convenience method so one does not have to loop through the `Items`
65
+ array of PlaylistTrack objects to get the list of tracks.
66
+ """
67
+ result:list[Track] = []
68
+ item:PlaylistTrack
69
+ for item in self._Items:
70
+ result.append(item.Track)
71
+ return result
72
+
73
+
59
74
  def ToString(self, includeItems:bool=False) -> str:
60
75
  """
61
76
  Returns a displayable string representation of the class.
@@ -85,7 +85,7 @@ class PlaylistSimplified:
85
85
  def __eq__(self, other):
86
86
  try:
87
87
  return self.Name == other.Name
88
- except Exception as ex:
88
+ except Exception:
89
89
  if (isinstance(self, PlaylistSimplified )) and (isinstance(other, PlaylistSimplified )):
90
90
  return self.Name == other.Name
91
91
  return False
@@ -93,7 +93,7 @@ class PlaylistSimplified:
93
93
  def __lt__(self, other):
94
94
  try:
95
95
  return self.Name < other.Name
96
- except Exception as ex:
96
+ except Exception:
97
97
  if (isinstance(self, PlaylistSimplified )) and (isinstance(other, PlaylistSimplified )):
98
98
  return self.Name < other.Name
99
99
  return False
@@ -155,6 +155,17 @@ class PlaylistSimplified:
155
155
  return self._Images
156
156
 
157
157
 
158
+ @property
159
+ def ImageUrl(self) -> str:
160
+ """
161
+ Gets the first image url in the `Images` list, if images are defined;
162
+ otherwise, null.
163
+ """
164
+ if len(self._Images) > 0:
165
+ return self._Images[0].Url
166
+ return None
167
+
168
+
158
169
  @property
159
170
  def Name(self) -> str:
160
171
  """
@@ -72,6 +72,18 @@ class PlaylistTrack:
72
72
  return self._AddedBy
73
73
 
74
74
 
75
+ @property
76
+ def ImageUrl(self) -> str:
77
+ """
78
+ Gets the first image url in the underlying track album `Images` list, if images are defined;
79
+ otherwise, null.
80
+ """
81
+ if self._Track is not None:
82
+ if self._Track.Album is not None:
83
+ return self._Track.Album.ImageUrl
84
+ return None
85
+
86
+
75
87
  @property
76
88
  def IsLocal(self) -> bool:
77
89
  """
@@ -2,6 +2,7 @@
2
2
 
3
3
  # our package imports.
4
4
  from ..sautils import export
5
+ from .show import Show
5
6
  from .showsaved import ShowSaved
6
7
  from .pageobject import PageObject
7
8
 
@@ -56,6 +57,20 @@ class ShowPageSaved(PageObject):
56
57
  return self._Items
57
58
 
58
59
 
60
+ def GetShows(self) -> list[Show]:
61
+ """
62
+ Gets a list of all shows contained in the underlying `Items` list.
63
+
64
+ This is a convenience method so one does not have to loop through the `Items`
65
+ array of ShowSaved objects to get the list of shows.
66
+ """
67
+ result:list[Show] = []
68
+ item:ShowSaved
69
+ for item in self._Items:
70
+ result.append(item.Show)
71
+ return result
72
+
73
+
59
74
  def ToString(self, includeItems:bool=False) -> str:
60
75
  """
61
76
  Returns a displayable string representation of the class.
@@ -86,7 +86,7 @@ class ShowSimplified:
86
86
  def __eq__(self, other):
87
87
  try:
88
88
  return self.Name == other.Name
89
- except Exception as ex:
89
+ except Exception:
90
90
  if (isinstance(self, ShowSimplified )) and (isinstance(other, ShowSimplified )):
91
91
  return self.Name == other.Name
92
92
  return False
@@ -94,7 +94,7 @@ class ShowSimplified:
94
94
  def __lt__(self, other):
95
95
  try:
96
96
  return self.Name < other.Name
97
- except Exception as ex:
97
+ except Exception:
98
98
  if (isinstance(self, ShowSimplified )) and (isinstance(other, ShowSimplified )):
99
99
  return self.Name < other.Name
100
100
  return False
@@ -174,6 +174,17 @@ class ShowSimplified:
174
174
  return self._Images
175
175
 
176
176
 
177
+ @property
178
+ def ImageUrl(self) -> str:
179
+ """
180
+ Gets the first image url in the `Images` list, if images are defined;
181
+ otherwise, null.
182
+ """
183
+ if len(self._Images) > 0:
184
+ return self._Images[0].Url
185
+ return None
186
+
187
+
177
188
  @property
178
189
  def IsExternallyHosted(self) -> bool:
179
190
  """
@@ -72,6 +72,17 @@ class Track(TrackSimplified):
72
72
  return self._ExternalIds
73
73
 
74
74
 
75
+ @property
76
+ def ImageUrl(self) -> str:
77
+ """
78
+ Gets the first image url in the album `Images` list, if images are defined;
79
+ otherwise, null.
80
+ """
81
+ if self._Album is not None:
82
+ return self._Album.ImageUrl
83
+ return None
84
+
85
+
75
86
  @property
76
87
  def Popularity(self) -> int:
77
88
  """
@@ -2,6 +2,7 @@
2
2
 
3
3
  # our package imports.
4
4
  from ..sautils import export
5
+ from .track import Track
5
6
  from .tracksaved import TrackSaved
6
7
  from .pageobject import PageObject
7
8
 
@@ -56,6 +57,20 @@ class TrackPageSaved(PageObject):
56
57
  return self._Items
57
58
 
58
59
 
60
+ def GetTracks(self) -> list[Track]:
61
+ """
62
+ Gets a list of all tracks contained in the underlying `Items` list.
63
+
64
+ This is a convenience method so one does not have to loop through the `Items`
65
+ array of TrackSaved objects to get the list of tracks.
66
+ """
67
+ result:list[Track] = []
68
+ item:TrackSaved
69
+ for item in self._Items:
70
+ result.append(item.Track)
71
+ return result
72
+
73
+
59
74
  def ToString(self, includeItems:bool=False) -> str:
60
75
  """
61
76
  Returns a displayable string representation of the class.
@@ -3,7 +3,7 @@
3
3
  # our package imports.
4
4
  from ..sautils import export
5
5
  from .recommendationseed import RecommendationSeed
6
- from .tracksimplified import TrackSimplified
6
+ from .track import Track
7
7
 
8
8
  @export
9
9
  class TrackRecommendations:
@@ -21,7 +21,7 @@ class TrackRecommendations:
21
21
  attributes; otherwise, None to not load attributes.
22
22
  """
23
23
  self._Seeds:list[RecommendationSeed] = []
24
- self._Tracks:list[TrackSimplified] = []
24
+ self._Tracks:list[Track] = []
25
25
 
26
26
  if (root is None):
27
27
 
@@ -36,7 +36,7 @@ class TrackRecommendations:
36
36
 
37
37
  items:list = root.get('tracks',[])
38
38
  for item in items:
39
- self._Tracks.append(TrackSimplified(root=item))
39
+ self._Tracks.append(Track(root=item))
40
40
 
41
41
 
42
42
  def __repr__(self) -> str:
@@ -56,9 +56,9 @@ class TrackRecommendations:
56
56
 
57
57
 
58
58
  @property
59
- def Tracks(self) -> list[TrackSimplified]:
59
+ def Tracks(self) -> list[Track]:
60
60
  """
61
- A list of TrackSimplified objects, ordered according to the parameters supplied.
61
+ A list of Track objects, ordered according to the parameters supplied.
62
62
  on the `GetTrackRecommendations` method.
63
63
  """
64
64
  return self._Tracks
@@ -2,7 +2,7 @@
2
2
 
3
3
  # our package imports.
4
4
  from ..sautils import export
5
- from .tracksimplified import TrackSimplified
5
+ from .track import Track
6
6
 
7
7
  @export
8
8
  class TrackSaved:
@@ -19,8 +19,8 @@ class TrackSaved:
19
19
  Spotify Web API JSON response in dictionary format, used to load object
20
20
  attributes; otherwise, None to not load attributes.
21
21
  """
22
- self._Track:TrackSimplified = None
23
22
  self._AddedAt:str = None
23
+ self._Track:Track = None
24
24
 
25
25
  if (root is None):
26
26
 
@@ -33,7 +33,7 @@ class TrackSaved:
33
33
  # process all collections and objects.
34
34
  item:dict = root.get('track',None)
35
35
  if item is not None:
36
- self._Track = TrackSimplified(root=item)
36
+ self._Track = Track(root=item)
37
37
 
38
38
 
39
39
  def __repr__(self) -> str:
@@ -58,7 +58,7 @@ class TrackSaved:
58
58
 
59
59
 
60
60
  @property
61
- def Track(self) -> TrackSimplified:
61
+ def Track(self) -> Track:
62
62
  """
63
63
  Information about the track.
64
64
  """
@@ -89,7 +89,7 @@ class TrackSimplified:
89
89
  def __eq__(self, other):
90
90
  try:
91
91
  return self.Name == other.Name
92
- except Exception as ex:
92
+ except Exception:
93
93
  if (isinstance(self, TrackSimplified )) and (isinstance(other, TrackSimplified )):
94
94
  return self.Name == other.Name
95
95
  return False
@@ -97,7 +97,7 @@ class TrackSimplified:
97
97
  def __lt__(self, other):
98
98
  try:
99
99
  return self.Name < other.Name
100
- except Exception as ex:
100
+ except Exception:
101
101
  if (isinstance(self, TrackSimplified )) and (isinstance(other, TrackSimplified )):
102
102
  return self.Name < other.Name
103
103
  return False
@@ -167,6 +167,16 @@ class TrackSimplified:
167
167
  return self._Id
168
168
 
169
169
 
170
+ @property
171
+ def ImageUrl(self) -> str:
172
+ """
173
+ Always returns null, as tracks currently do not support images.
174
+
175
+ Added for compatibility with other objects.
176
+ """
177
+ return None
178
+
179
+
170
180
  @property
171
181
  def IsLocal(self) -> bool:
172
182
  """
@@ -129,6 +129,17 @@ class UserProfileSimplified:
129
129
  return self._Images
130
130
 
131
131
 
132
+ @property
133
+ def ImageUrl(self) -> str:
134
+ """
135
+ Gets the first image url in the `Images` list, if images are defined;
136
+ otherwise, null.
137
+ """
138
+ if len(self._Images) > 0:
139
+ return self._Images[0].Url
140
+ return None
141
+
142
+
132
143
  @property
133
144
  def Type(self) -> str:
134
145
  """
@@ -132,6 +132,25 @@ class SpotifyAuthToken:
132
132
  return self._ExpiresAt
133
133
 
134
134
 
135
+ @property
136
+ def HeaderKey(self) -> str:
137
+ """
138
+ Returns a string containing the header key to assign the authorization token value to.
139
+ This will always return 'Authorization'.
140
+ """
141
+ return 'Authorization'
142
+
143
+
144
+ @property
145
+ def HeaderValue(self) -> str:
146
+ """
147
+ Returns the value portion of the authorization header, in the form of '{tokentype} {token}'.
148
+
149
+ Example: `Bearer {token value ...}'
150
+ """
151
+ return '{tokentype} {token}'.format(tokentype=self.TokenType, token=self.AccessToken)
152
+
153
+
135
154
  @property
136
155
  def IsExpired(self) -> bool:
137
156
  """
@@ -202,17 +221,6 @@ class SpotifyAuthToken:
202
221
  return self._TokenType
203
222
 
204
223
 
205
- def GetHeaders(self) -> dict:
206
- """
207
- Returns a dictionary containing an 'Authorization': 'Bearer {token}' value,
208
- which can be used when makeing requests to the Spotify Web API.
209
- """
210
- headers:dict = {
211
- 'Authorization': '{tokentype} {token}'.format(tokentype=self.TokenType, token=self.AccessToken)
212
- }
213
- return headers
214
-
215
-
216
224
  def ToString(self) -> str:
217
225
  """
218
226
  Returns a displayable string representation of the class.