Skip to main content

Simplest integration of Spotify into Python

Project description

Pyspotify Utils

This repository attempts to make it as simple as possible to integrate pyspotify.

It’s currently as simple as # pip install pyspotify_helper # python >>> from pyspotify_helper import Spotify >>> spotify_pro_credentials = { “spotify_name”: “”, “spotify_password”: “” } >>> Spotify(spotify_pro_credentials).play(“Stadium Arcadium”, “albums”)


Sadly, that simplicity comes after some initialization.

You need a spotify_appkey.key in your project root directory. You can get this following the tutorial at


libspotify pyspotify

Information on installing dependencies at


The most important method is play(name, category, shuffle=False). Name is a free-form string that will be searched on Spotify (more info at Category is one of “tracks”, “artists”, or “albums”. Shuffle decides whether or not the music gets shuffled when played.

If no results are found, there will be an error. (IndexError: list index out of range)

The play() method does not block. They return immediately, while a different thread is started to play the music.

There are four methods to control playback: next_track, pause, resume, and pause_toggle.

These methods will cancel the currently playing song when called.

Spotify() returns a singleton. The credentials only need to be passed in the first time you call the function. See the “if __name__ == ‘__main__’:” section.

TODO (As in, questions for you and my future self):

How does searching work with playlists? More specifically, can I easily distinguish between owned playlists and other playlists? What about playlists with the same name?

Project details

Release history Release notifications

Download files

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

Files for pyspotify_helper, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size pyspotify_helper-0.0.1.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page