spotr - Terminal Spotify Tool
raw JSON → 4.1 verified Sat May 09 auth: no python
A simple Spotify tool for the terminal that allows searching, playing, and managing Spotify playlists and tracks. Current version 4.1, released with Python >=3.6 support. Maintenance cadence is irregular.
pip install spotrpy Common errors
error spotipy.exceptions.SpotifyException: http status: 400, code: -1 - Invalid client ↓
cause Client ID or Client Secret is incorrect or not set.
fix
Verify SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET in your environment or constructor.
error AttributeError: module 'spotr' has no attribute 'Spotr' ↓
cause Incorrect import path. spotrpy installs the package as 'spotr'.
fix
Use 'from spotr import Spotr' instead of 'import spotr' and then spotr.Spotr.
error spotipy.exceptions.SpotifyException: http status: 403, code: -1 - Forbidden ↓
cause Missing required scopes for the API call.
fix
Ensure you request the necessary scopes (e.g., playlist-modify-public) during authentication.
Warnings
breaking spotrpy v4.0+ dropped support for Python 3.5 and below. Requires >=3.6. ↓
fix Upgrade Python to 3.6+ or pin spotrpy to <4.0.
gotcha client_id and client_secret are required; if not provided, Spotr will raise an error. ↓
fix Always set SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET environment variables or pass them to constructor.
gotcha The redirect_uri must match exactly what is registered in Spotify Developer Dashboard. Usually http://localhost:8888/callback ↓
fix Register the exact redirect URI in your Spotify app.
Imports
- Spotr
from spotr import Spotr
Quickstart
from spotr import Spotr
import os
sp = Spotr(client_id=os.environ.get('SPOTIFY_CLIENT_ID', ''),
client_secret=os.environ.get('SPOTIFY_CLIENT_SECRET', ''),
redirect_uri='http://localhost:8888/callback')
# Then use sp methods like sp.search('song')