Skip to main content

Communicate with the Spotify's web helper process to control some basic aspects of spotify

Project description

Spotify-Local: A multi-platform API to control the local Spotify Client

Spotify-Local library is designed to make controlling the Spotify client on your local machine possible! This is a wrapper for the web helper process which exposes a simple api. Spotify-Local is inspired by SpotifyAPI-NET. This library allows you to perform simple actions quickly, or listen to events and register callbacks when a song changes, or the pause button is pushed.

When using this library you automatically get:

  • The ability to play/pause the current song
  • The ability to change tracks
  • You can register callbacks and listen for events when the state of Spotify changes
  • A nice context manager api using with


$ pipenv install spotify-local

Only Python 3.3+ is supported.

Tutorial & Usage

Connect to the Spotify Client (Spotify must be open to do this):

>>> from spotify_local import SpotifyLocal

>>> with SpotifyLocal() as s:

Pause the Spotify Client:

>>> with SpotifyLocal() as s:

Grab the current state of the Spotify client, including now playing information:

>>> with SpotifyLocal() as s:

Play a playlist, song, album, artist, etc using a Spotify uri link:

>>> with SpotifyLocal() as s:

Register a callback and listen for events:

>>> from spotify_local import SpotifyLocal
>>> s = SpotifyLocal()
>>> @s.on('track_change')
>>> def test(event):
...     print(event)
>>> s.listen(blocking=False)
>>> print("Do more stuff because that runs in the background")




  • Create an async verion of the spotify controller class

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for spotify-local, version 0.3.2
Filename, size File type Python version Upload date Hashes
Filename, size spotify_local-0.3.2-py2.py3-none-any.whl (5.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size spotify-local-0.3.2.tar.gz (6.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page