Skip to main content

Sync/Async API wrapper for Spotify's web API

Project description


Build Status Software License Code style: black Downloads Monthly Downloads

Web API Wrapper for Spotify in Python


  • Async and Sync clients
  • Authenticate using:
    • OAuth2 client credentials flow
    • OAuth2 authroization code flow
    • Access token only authorization
  • Covers every parameter for every endpoint in Spotify's Web API
  • Automatically refreshes tokens for clients and users
  • Descriptive errors
  • Able to automatically default to user's locales
  • Rate limiting
  • HTTP and SOCKS proxies
  • HTTP caching (Sync only)
  • Unit and integration tested
  • Fit for both production and experimental/personal environments
  • Begginner friendly interface
  • Almost identical Async and Sync Interfaces

Quick Start


from pyfy import Spotify

spt = Spotify('your_access_token')

results ='alice in chains them bones')


import asyncio
from pyfy import AsyncSpotify

spt = AsyncSpotify('your_access_token')

async def query():
    return await'Like a motherless child')

res =


Documentation 📑

Readthedocs: (

Setup ⚙️

$ pip install pyfy

Backward Incompatibility Notices


  1. Removed Spotify.oauth_uri property in favor of Spotify.auth_uri method.

  2. now accepts, track_ids, artist_ids etc. instead of resource_ids + resource_names

  3. Oauth2 state handling:

    • Removed deprecated enforce_state_check functionality

    • Removed state attribute from user_creds

    • Oauth2 state checking is no longer done by Pyfy's client and should be handled manually


Big thank you to our amazing contributors:

Contact 📧

I currently work as a freelance software devloper. Like my work and got a gig for me?

Want to hire me fulltime? Send me an email @

Buy me a coffee ☕

Bitcoin: 3NmywNKr1Lzo8gyNXFUnzvboziACpEa31z

Ethereum: 0x1E1400C31Cd813685FE0f6D29E0F91c1Da4675aE

Bitcoin Cash: qqzn7rsav6hr3zqcp4829s48hvsvjat4zq7j42wkxd

Litecoin: MB5M3cE3jE4E8NwGCWoFjLvGqjDqPyyEJp


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 pyfy, version 2.0.7
Filename, size File type Python version Upload date Hashes
Filename, size pyfy-2.0.7.tar.gz (40.7 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