Created
August 19, 2019 14:29
-
-
Save badalnabizade/348cd1993b7f6248b2ddaad544e44826 to your computer and use it in GitHub Desktop.
Getting artists data from Spotify API:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_artist(name): | |
""" | |
---------- | |
name: 'Name of Spotify artist' | |
---------- | |
Returns: dictionary object. | |
Given Spotify Artist's information. | |
""" | |
results = sp.search(q='artist:' + name, type='artist') | |
items = results['artists']['items'] | |
if len(items) > 0: | |
return items[0] | |
else: # If this artist does't exsists. | |
return None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment