Overview

docs

Documentation Status

package

PyPI Package latest release PyPI Wheel Supported versions

Another wrapper for the Spotify Web API, built on top of requests and requests_oauthlib.

I wrote this package as a kind of “code generation experiment”: the code (and doc) of Spotify class was almost entirely generated using a script that scrapes the official Spotify Web API documentation.

For scripts and desktop apps, this package (optionally) includes a flask server (meant to be run locally) to handle user authorization without requiring the user to manually copy and paste the OAuth2 callback URL (containing the token) from the browser to your app.

  • Free software: MIT license

Installation

If you don’t need the authorization flask app:

pip install spotipie

otherwise:

pip install spotipie[auth-app]

Usage

You first need to create an OAuth2 session and obtain an authorization token for it. There’s a different OAuth2 session class for each of the three OAuth2 authorization flows supported by the Spotify API (see Authorization Flows):

  • ClientCredentialsSession

  • AuthorizationCodeSession

  • ImplicitGrantSession

Then you can wrap the session with a Spotify object.