Spotify SDK for Python
spotify-sdk is a Python client for the
Spotify Web API.
It provides sync and async interfaces with type-safe responses, so you
can build apps against Spotify without managing raw HTTP or JSON.
Community Project
This is an independent, community-developed library and is not affiliated with or endorsed by Spotify.
Quickstart Installation API Reference View on GitHub
Features
- Type-safe models: Pydantic models with full type hints for every response
- Sync and async clients:
SpotifyClientandAsyncSpotifyClientwith identical APIs - Automatic retries: Exponential backoff with jitter for rate limits, server errors, and timeouts
- Auth helpers: Client credentials, authorization code, and local browser-based flows
- Token caching: Built-in in-memory cache with a pluggable
TokenCacheinterface - Context managers:
withandasync withsupport for clean resource cleanup
Start in 60 Seconds
-
Quickstart
Install, configure auth, and make your first API call in minutes.
-
Authentication
Client credentials, authorization code,
auth.authorize_local(), and pluggable token caching. -
Services
Albums, Artists, Audiobooks, Chapters, Episodes, Library, Playlists, Search, Shows, Tracks, and Users.
-
Installation
Install with
uvorpipand verify your setup. Requires Python 3.10+. -
Error Handling
Handle
RateLimitError,AuthenticationError, and other SDK exceptions. -
Clients & Models
Full reference for client configuration and Pydantic response models.