Skip to content

a simple python script that allows you to control playback of spotify connect without the need of a local server

Notifications You must be signed in to change notification settings

Intika-Linux-Spotify/Web-API-Spotify

This branch is up to date with eclair4151/Local-Spotify-Web-Connect-Api-Python:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Apr 17, 2020
1ccf63e · Apr 17, 2020

History

8 Commits
Sep 30, 2018
Apr 17, 2020
Sep 30, 2018
Sep 30, 2018

Repository files navigation

Spotify Web Connect Api Local Python Example

a simple python script that allows you to control playback of spotify connect without the need of a local server
Spotify Documentation: https://developer.spotify.com/documentation/web-api/guides/using-connect-web-api/

How To Use

Follow these instructions to create a spotify app
https://developer.spotify.com/documentation/general/guides/app-settings/

The name and description are up to you.
Add the whitelisted redirect url 'http://Localhost'

Then copy and paste an Client_id and Client_secret of the app into the constants.py file

From there you can just run
python3 spotify.py
to authorize it. Copy and paste the url printed from the script into your browser and click ok to authorize. You will then be redirected to a url that looks like http://localhost?code=XXXXXXXXXX ect
Copy and paste that url back into the terminal to complete authorization.

Now you can just call the provided script methods to play, pause, set the volume, get devices and playlists.
This authorization flow works for the rest of the api as well so feel free to browse around https://developer.spotify.com/documentation/web-api/reference/ to see what other api endpoints you can add to the script.

This script will also handle the refresh token for you. Every time you call a command it will check if the current token is expired and if it is, it automagicly use the refresh token and gets a valid access_token before the command is called

About

a simple python script that allows you to control playback of spotify connect without the need of a local server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%