System Gen84 @ 2025-07-24-02:00:39 by jonas@monolith
This commit is contained in:
18
pkgs/spotify-shortcuts/spotify_shortcuts/spotify_auth.py
Normal file
18
pkgs/spotify-shortcuts/spotify_shortcuts/spotify_auth.py
Normal file
@@ -0,0 +1,18 @@
|
||||
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,
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user