Player endpoints example and test

This commit is contained in:
Stephane Bruckert committed 2020-02-22 11:12:29 +00:00
1 parent 125267fa4e
commit 9ed584b398
2 files changed
+25

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
import spotipy
from spotipy.oauth2 import SpotifyOAuth
from pprint import pprint
from time import sleep
sp = spotipy.Spotify(client_credentials_manager=SpotifyOAuth(scope="user-read-playback-state,user-modify-playback-state"))
# Shows playing devices
res = sp.devices()
pprint(res)
# Change track
sp.start_playback(uris=['spotify:track:6gdLoMygLsgktydTQ71b15'])
# Change volume
sp.volume(100)
sleep(2)
sp.volume(50)
sleep(2)
sp.volume(100)