mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
Update show_related.py
Import SpotifyClientCredentials from spotipy.oauth2
This commit is contained in:
parent
5a00758609
commit
90f1105648
@ -2,6 +2,7 @@
|
|||||||
# shows related artists for the given seed artist
|
# shows related artists for the given seed artist
|
||||||
|
|
||||||
import spotipy
|
import spotipy
|
||||||
|
from spotipy.oauth2 import SpotifyClientCredentials
|
||||||
import sys
|
import sys
|
||||||
import pprint
|
import pprint
|
||||||
|
|
||||||
@ -10,7 +11,9 @@ if len(sys.argv) > 1:
|
|||||||
else:
|
else:
|
||||||
artist_name = 'weezer'
|
artist_name = 'weezer'
|
||||||
|
|
||||||
sp = spotipy.Spotify()
|
|
||||||
|
client_credentials_manager = SpotifyClientCredentials()
|
||||||
|
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||||
result = sp.search(q='artist:' + artist_name, type='artist')
|
result = sp.search(q='artist:' + artist_name, type='artist')
|
||||||
try:
|
try:
|
||||||
name = result['artists']['items'][0]['name']
|
name = result['artists']['items'][0]['name']
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user