1import spotipy
2import spotipy as spotipy
3from spotipy.oauth2 import SpotifyOAuth
4from pprint import pprint
5from time import sleep
6
7scope = "user-read-playback-state,user-modify-playback-state"
8sp = spotipy.Spotify(client_credentials_manager=SpotifyOAuth(client_id="CLIENT_ID GET FROM SPOTIFY DASHBOARD",
9 client_secret="SECRET_CLIENT_ID",
10 redirect_uri="https://developer.spotify.com/",
11 scope='user-read-playback-state,user-modify-playback-state'))
12float
13# Shows playing devices
14res = sp.devices()
15pprint(res)
16
17# Change track
18sp.start_playback(uris=['spotify:track:0HUTL8i4y4MiGCPId7M7wb'])
1curl -sS https://download.spotify.com/debian/pubkey.gpg | sudo apt-key add - curl -sS https://download.spotify.com/debian/pubkey_0D811D58.gpg | sudo apt-key add - echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list