Skip to main content

Sync/Async API wrapper for Spotify's web API

Project description

Logo

Build Status Software License Code style: black Downloads Monthly Downloads

Web API Wrapper for Spotify in Python

Features

  • 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

Sync:

from pyfy import Spotify

spt = Spotify('your_access_token')

spt.user_playlists()
spt.play()
spt.volume(85)
spt.next()
spt.pause()
results = spt.search(q='alice in chains them bones')
print(results)

Async:

import asyncio
from pyfy import AsyncSpotify

spt = AsyncSpotify('your_access_token')

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

res = asyncio.run(query())

print(res)

Documentation 📑

Readthedocs: (https://pyfy.readthedocs.io/en/latest)

Setup ⚙️

$ pip install pyfy

Backward Incompatibility Notices

V2:

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

  2. Spotify.play() 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

Contributors

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 @ omarryhan@gmail.com

Buy me a coffee ☕

Bitcoin: 3NmywNKr1Lzo8gyNXFUnzvboziACpEa31z

Ethereum: 0x1E1400C31Cd813685FE0f6D29E0F91c1Da4675aE

Bitcoin Cash: qqzn7rsav6hr3zqcp4829s48hvsvjat4zq7j42wkxd

Litecoin: MB5M3cE3jE4E8NwGCWoFjLvGqjDqPyyEJp

Paypal: https://paypal.me/omarryhan

Project details


Download files

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

Source Distribution

pyfy-2.0.4.tar.gz (40.7 kB view details)

Uploaded Source

File details

Details for the file pyfy-2.0.4.tar.gz.

File metadata

  • Download URL: pyfy-2.0.4.tar.gz
  • Upload date:
  • Size: 40.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for pyfy-2.0.4.tar.gz
Algorithm Hash digest
SHA256 9c9d64c42d961f672b8703532fe0ad6edae2bfac2a85232116a8071b24fea26a
MD5 eb18741dcc4079370ff44bede8834718
BLAKE2b-256 9a2a7717bf86ebf2dd4fcd2b53d4e8fd50be0737e717ce220f020808cebb4c38

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page