Skip to main content is an asynchronous API wrapper for Spotify written in Python.

Project description

![Version info](
[![GitHub stars](](

An API library for the spotify client and the Spotify Web API written in Python. is 100% asyncronous meaning everything down to the HTTP library is designed to work with asyncio.<br>The library offers coverage over every endpoint in the Spotify web API.

As of v0.1.5 it is possible to use in a syncronous manner. No await/async syntax required! To do this simply use

import spotify.sync as spotify # and now no methods require the async/await syntax.

Added in v0.3.0 it's now possible to have self refreshing User sessions, this update allows for users to hand off the second half of the OAuth flow directly to the library which will ensure an authenticated session for the duration of the User objects lifetime. See the [example](examples/!

## Examples

- Top tracks (drake)

import spotify

client = spotify.Client('someid', 'sometoken')

async def example():
drake = await client.get_artist('3TVXtAsR1Inumwj472S9r4')

for track in await drake.top_tracks():

- Backing up playlists

import json
import time

import spotify
from spotify import User

client = spotify.Client('someid', 'sometoken')

async def backup():
user = await User.from_token(client, 'sometoken')
backup_data = []

for playlist in await user.get_playlists():

'metadata': [, playlist.public, playlist.collaborative, playlist.description],
'tracks': []

for track in await playlist.get_tracks():

with open('spotify_playlists_%s_%s.json' % (, int(time.time())), 'w') as file:
json.dump(backup_data, file)

## Resources

For resources look at the [examples]( or ask in the [discord](

## Installing

To install the library simply clone it and run
- `git clone`
- `python3 install`

or use pypi

- `pip3 install spotify`
- `pip3 install -U git+` (recommened)

## Contributing
To contribute you must:
- have a presence in the [discord]( server
- fork and open a PR with changes.

> is in beta, there may be bugs.

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
spotify-0.3.0.tar.gz (17.3 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page