Skip to main content

Spotipy

Spotipy is a lightweight Python library for the Spotify Web API. With Spotipy you get full access to all of the music data provided by the Spotify platform.

Integration tests Documentation Status Discord server

Table of Contents

Features

Spotipy supports all of the features of the Spotify Web API including access to all end points, and support for user authorization. For details on the capabilities you are encouraged to review the Spotify Web API documentation.

Installation

pip install spotipy

alternatively, for Windows users

py -m pip install spotipy

or upgrade

pip install spotipy --upgrade

Quick Start

A full set of examples can be found in the online documentation and in the Spotipy examples directory.

To get started, install spotipy, create a new account or log in on https://developers.spotify.com/. Go to the dashboard, create an app and add your new ID and SECRET (ID and SECRET can be found on an app setting) to your environment:

Example without user authentication

import spotipy
from spotipy.oauth2 import SpotifyClientCredentials

sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials(client_id="YOUR_APP_CLIENT_ID",
                                                           client_secret="YOUR_APP_CLIENT_SECRET"))

results = sp.search(q='weezer', limit=20)
for idx, track in enumerate(results['tracks']['items']):
    print(idx, track['name'])

Expected result:

0 Island In The Sun
1 Say It Ain't So
2 Buddy Holly
.
.
.
18 Troublemaker
19 Feels Like Summer

Example with user authentication

A redirect URI must be added to your application at My Dashboard to access user authenticated features.

import spotipy
from spotipy.oauth2 import SpotifyOAuth

sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id="YOUR_APP_CLIENT_ID",
                                               client_secret="YOUR_APP_CLIENT_SECRET",
                                               redirect_uri="YOUR_APP_REDIRECT_URI",
                                               scope="user-library-read"))

results = sp.current_user_saved_tracks()
for idx, item in enumerate(results['items']):
    track = item['track']
    print(idx, track['artists'][0]['name'], " – ", track['name'])

Expected result will be the list of music that you liked. For example if you liked Red and Sunflower, the result will be:

0 Post Malone  –  Sunflower - Spider-Man: Into the Spider-Verse
1 Taylor Swift  –  Red

Reporting Issues

For common questions please check our FAQ.

You can ask questions about Spotipy on Stack Overflow. Don’t forget to add the Spotipy tag, and any other relevant tags as well, before posting.

If you have suggestions, bugs or other issues specific to this library, file them here. Or just send a pull request.

Contributing

If you are a developer with Python experience, and you would like to contribute to Spotipy, please be sure to follow the guidelines listed on documentation page

Visit the guideline

Release files for spotipy 2.26.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spotipy 2.26.0
File Size Uploaded
spotipy-2.26.0.tar.gz 45.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spotipy 2.26.0
File Interpreter ABI Platform
spotipy-2.26.0-py3-none-any.whl Python 3 none any Details

Total release size: 77.3 kB

Release files / spotipy-2.26.0.tar.gz

Download URL spotipy-2.26.0.tar.gz
Size 45.3 kB
Tags Source
SHA-256 checksum
How to use checksums
df6a25d8209072efa8cea165608ee644884e3804f8762b6d8e06ca1a5c7f8a63
BLAKE2b-256 checksum
How to use checksums
88002de6f99c9b8e5fd519fd55b11ec94b8e97a51e8a9fdf546edfe6aaf8727b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / spotipy-2.26.0-py3-none-any.whl

Download URL spotipy-2.26.0-py3-none-any.whl
Size 32.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2726854ddfa0e5624aada592e737832ec75bdc00ae12c102779f8bd995329d49
BLAKE2b-256 checksum
How to use checksums
f5ff594b82c19b3291eb3f9454beba7f74f19753035fb9b3e54eebd5ae5013a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

2.26.0 This release

2 release files

2.25.2

2 release files

2.25.1

2 release files

2.24.0

2 release files

2.22.1

3 release files

2.22.0

3 release files

2.21.0

3 release files

2.20.0

3 release files

2.19.0

3 release files

2.18.0

2 release files

2.17.1

2 release files

2.17.0

2 release files

2.16.1

3 release files

2.16.0

3 release files

2.14.0

3 release files

2.13.0

3 release files

2.12.0

3 release files

2.11.2

3 release files

2.11.1

3 release files

2.11.0

3 release files

2.10.0

3 release files

2.9.0

3 release files

2.8.0

3 release files

2.7.1

2 release files

2.7.0

3 release files

2.6.3

3 release files

2.6.2

2 release files

2.6.1

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.4

1 release file

2.4.3

1 release file

2.4.2

1 release file

2.4.1

1 release file

2.4.0

1 release file

2.3.8

1 release file

2.3.7

1 release file

2.3.6

1 release file

2.3.5

1 release file

2.3.4

1 release file

2.3.3

1 release file

2.3.2

1 release file

2.3.0

1 release file

2.2.0

1 release file

2.1.0

1 release file

2.0.2

1 release file

2.0.1

1 release file

0.2

3 release files

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page