19 lines
626 B
Python
19 lines
626 B
Python
from spotipy.oauth2 import SpotifyOAuth
|
|
from spotipy import Spotify
|
|
from spotify_shortcuts.config import Config
|
|
|
|
|
|
def authenticated_session(cfg: Config) -> Spotify:
|
|
assert cfg.client_id, "Spotify client ID is required"
|
|
assert cfg.client_secret, "Spotify client secret is required"
|
|
|
|
return Spotify(
|
|
auth_manager=SpotifyOAuth(
|
|
client_id=cfg.client_id,
|
|
client_secret=cfg.client_secret,
|
|
redirect_uri="http://127.0.0.1:45632/callback",
|
|
scope="user-library-read user-library-modify user-read-playback-state",
|
|
cache_path=cfg.cache_file,
|
|
)
|
|
)
|