mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
Update simple3.py
add import statements for oath
This commit is contained in:
parent
ba667d388c
commit
faa5785a29
@ -1,14 +1,16 @@
|
|||||||
import spotipy
|
import spotipy
|
||||||
|
from spotipy.oauth2 import SpotifyClientCredentials
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
spotify = spotipy.Spotify()
|
client_credentials_manager = SpotifyClientCredentials()
|
||||||
|
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
name = ' '.join(sys.argv[1:])
|
name = ' '.join(sys.argv[1:])
|
||||||
else:
|
else:
|
||||||
name = 'Radiohead'
|
name = 'Radiohead'
|
||||||
|
|
||||||
results = spotify.search(q='artist:' + name, type='artist')
|
results = sp.search(q='artist:' + name, type='artist')
|
||||||
items = results['artists']['items']
|
items = results['artists']['items']
|
||||||
if len(items) > 0:
|
if len(items) > 0:
|
||||||
artist = items[0]
|
artist = items[0]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user