diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cc825f..50d812b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix `user_playlists_contents` example. - 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__` +- Replaced `artist_albums(album_type=...)` with `artist_albums(include_groups=...)` due to an API change. ### Fixed - Fixed unused description parameter in playlist creation example diff --git a/spotipy/client.py b/spotipy/client.py index 7d81b1f..8a4d72f 100644 --- a/spotipy/client.py +++ b/spotipy/client.py @@ -405,22 +405,33 @@ class Spotify(object): return self._get("artists/?ids=" + ",".join(tlist)) 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 Parameters: - 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. - limit - the number of albums 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) return self._get( "artists/" + trid + "/albums", - album_type=album_type, + include_groups=include_groups, country=country, limit=limit, offset=offset,