mirror of
https://github.com/c0de-archive/spotipy.git
synced 2025-10-09 19:28:34 +00:00
Added examples, improved docs
This commit is contained in:
16
examples/show_artist_top_tracks.py
Normal file
16
examples/show_artist_top_tracks.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# shows artist info for a URN or URL
|
||||
|
||||
import spotipy
|
||||
import sys
|
||||
import pprint
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
urn = sys.argv[1]
|
||||
else:
|
||||
urn = 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu'
|
||||
|
||||
sp = spotipy.Spotify()
|
||||
response = sp.artist_top_tracks(urn)
|
||||
|
||||
for track in response['tracks']:
|
||||
print track['name']
|
17
examples/show_user.py
Normal file
17
examples/show_user.py
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
# shows artist info for a URN or URL
|
||||
|
||||
import spotipy
|
||||
import sys
|
||||
import pprint
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
username = sys.argv[1]
|
||||
else:
|
||||
username = 'plamere'
|
||||
|
||||
sp = spotipy.Spotify()
|
||||
sp.trace = True
|
||||
user = sp.user(username)
|
||||
pprint.pprint(user)
|
||||
|
Reference in New Issue
Block a user