mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
Merge pull request #1108 from spotipy-dev/1107-artist_albums-include_groups
Replaced argument "album_type" with "include_groups" in "Spotify.artist_albums"
This commit is contained in:
commit
070b54f494
@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Fix `user_playlists_contents` example.
|
- Fix `user_playlists_contents` example.
|
||||||
- Updated links to Spotify in documentation
|
- Updated links to Spotify in documentation
|
||||||
- Fixed error obfuscation when Spotify class is being inherited and an error is raised in the Child's `__init__`
|
- Fixed error obfuscation when Spotify class is being inherited and an error is raised in the Child's `__init__`
|
||||||
|
- Replaced `artist_albums(album_type=...)` with `artist_albums(include_groups=...)` due to an API change.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed unused description parameter in playlist creation example
|
- Fixed unused description parameter in playlist creation example
|
||||||
|
|||||||
@ -405,22 +405,33 @@ class Spotify(object):
|
|||||||
return self._get("artists/?ids=" + ",".join(tlist))
|
return self._get("artists/?ids=" + ",".join(tlist))
|
||||||
|
|
||||||
def artist_albums(
|
def artist_albums(
|
||||||
self, artist_id, album_type=None, country=None, limit=20, offset=0
|
self, artist_id, album_type=None, include_groups=None, country=None, limit=20, offset=0
|
||||||
):
|
):
|
||||||
""" Get Spotify catalog information about an artist's albums
|
""" Get Spotify catalog information about an artist's albums
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
- artist_id - the artist ID, URI or URL
|
- artist_id - the artist ID, URI or URL
|
||||||
- album_type - 'album', 'single', 'appears_on', 'compilation'
|
- include_groups - the types of items to return. One or more of 'album', 'single',
|
||||||
|
'appears_on', 'compilation'. If multiple types are desired,
|
||||||
|
pass in a comma separated string; e.g., 'album,single'.
|
||||||
- country - limit the response to one particular country.
|
- country - limit the response to one particular country.
|
||||||
- limit - the number of albums to return
|
- limit - the number of albums to return
|
||||||
- offset - the index of the first album to return
|
- offset - the index of the first album to return
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if album_type:
|
||||||
|
warnings.warn(
|
||||||
|
"You're using `artist_albums(..., album_type='...')` which will be removed in "
|
||||||
|
"future versions. Please adjust your code accordingly by using "
|
||||||
|
"`artist_albums(..., include_groups='...')` instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
)
|
||||||
|
include_groups = include_groups or album_type
|
||||||
|
|
||||||
trid = self._get_id("artist", artist_id)
|
trid = self._get_id("artist", artist_id)
|
||||||
return self._get(
|
return self._get(
|
||||||
"artists/" + trid + "/albums",
|
"artists/" + trid + "/albums",
|
||||||
album_type=album_type,
|
include_groups=include_groups,
|
||||||
country=country,
|
country=country,
|
||||||
limit=limit,
|
limit=limit,
|
||||||
offset=offset,
|
offset=offset,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user