mirror of
https://github.com/c0de-archive/spotipy.git
synced 2024-11-05 07:27:47 +00:00
Added api to get current users followed artists
This commit is contained in:
parent
10cf88da90
commit
329ef5722b
@ -486,6 +486,16 @@ class Spotify(object):
|
|||||||
'''
|
'''
|
||||||
return self._get('me/tracks', limit=limit, offset=offset)
|
return self._get('me/tracks', limit=limit, offset=offset)
|
||||||
|
|
||||||
|
def current_user_followed_artists(self, limit=20, after=None):
|
||||||
|
''' Gets a list of the artists followed by the current authorized user
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
- limit - the number of tracks to return
|
||||||
|
- after - ghe last artist ID retrieved from the previous request
|
||||||
|
|
||||||
|
'''
|
||||||
|
return self._get('me/following', type='artist', limit=limit, after=after)
|
||||||
|
|
||||||
def current_user_saved_tracks_delete(self, tracks=[]):
|
def current_user_saved_tracks_delete(self, tracks=[]):
|
||||||
''' Remove one or more tracks from the current user's
|
''' Remove one or more tracks from the current user's
|
||||||
"Your Music" library.
|
"Your Music" library.
|
||||||
|
@ -105,6 +105,11 @@ class AuthTestSpotipy(unittest.TestCase):
|
|||||||
response = spotify.featured_playlists()
|
response = spotify.featured_playlists()
|
||||||
self.assertTrue(len(response['playlists']) > 0)
|
self.assertTrue(len(response['playlists']) > 0)
|
||||||
|
|
||||||
|
def test_current_user_follows(self):
|
||||||
|
response = spotify.current_user_followed_artists()
|
||||||
|
artists = response['artists']
|
||||||
|
self.assertTrue(len(artists['items']) > 0)
|
||||||
|
|
||||||
def get_or_create_spotify_playlist(self, username, playlist_name):
|
def get_or_create_spotify_playlist(self, username, playlist_name):
|
||||||
playlists = spotify.user_playlists(username)
|
playlists = spotify.user_playlists(username)
|
||||||
while playlists:
|
while playlists:
|
||||||
@ -161,6 +166,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
scope = 'playlist-modify-public '
|
scope = 'playlist-modify-public '
|
||||||
scope += 'user-library-read '
|
scope += 'user-library-read '
|
||||||
|
scope += 'user-follow-read '
|
||||||
scope += 'user-library-modify '
|
scope += 'user-library-modify '
|
||||||
scope += 'user-read-private'
|
scope += 'user-read-private'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user