Welcome
spotify-sdk is a modern, type-safe Python SDK for the Spotify Web API. Fetch albums, artists, tracks, and more with both sync and async clients.
-
Installation
Install with pip or uv and start building in seconds.
-
Quickstart
Learn the basics with sync and async examples.
-
API Reference
Explore clients, services, and method signatures.
-
Configuration
Customize timeouts, retries, and client behavior.
-
Auth
Client credentials, custom providers, and token caching.
-
Error Handling
Handle rate limits, auth errors, and API failures gracefully.
Features
- Type-safe - Full type hints with Pydantic models for all API responses
- Sync and async - Dedicated
SpotifyClientandAsyncSpotifyClientclasses - Automatic retries - Exponential backoff with jitter for rate limits and transient errors
- Context managers - Clean resource management with
withandasync withsupport
Quick Example
from spotify_sdk import SpotifyClient
with SpotifyClient(access_token="your-access-token") as client:
album = client.albums.get("7ycBtnsMtyVbbwTfJwRjSP")
print(f"{album.name} by {album.artists[0].name}") # (1)!
- Output:
To Pimp A Butterfly by Kendrick Lamar
Community Project
This is an independent, community-developed library and is not affiliated with or endorsed by Spotify.