Exemplo n.º 1
0
def spotify_user_auth():
    spotify = Spotify()
    user_creds = UserCreds()
    client_creds = ClientCreds()
    client_creds.load_from_env()
    user_creds.load_from_env()
    spotify.client_creds = client_creds
    spotify.user_creds = user_creds
    spotify._caller = spotify.user_creds
    yield spotify
from pyfy import Spotify, ClientCreds, UserCreds
from utils import config

# Init pyfy
spotify = Spotify()
client_creds = ClientCreds(
    client_id=config["spotify"]["client_id"],
    client_secret=config["spotify"]["client_secret"],
    redirect_uri=config["spotify"]["client_redirect"],
    scopes=["user-read-recently-played", "user-read-playback-state"],
)
spotify.client_creds = client_creds


def get_credentials(user):
    return UserCreds(access_token=user.spotify_access_token,
                     refresh_token=user.spotify_refresh_token)
Exemplo n.º 3
0
def spotify_client_auth():
    spotify = Spotify()
    client_creds = ClientCreds()
    client_creds.load_from_env()
    spotify.client_creds = client_creds
    yield spotify
from pyfy import Spotify, ClientCreds, UserCreds
from utils import config

# Init pyfy
spt = Spotify()
client = ClientCreds(
    client_id=config["spotify"]["client_id"],
    client_secret=config["spotify"]["client_secret"],
    redirect_uri=config["spotify"]["client_redirect"],
    scopes=["user-read-recently-played", "user-read-playback-state"],
)
spt.client_creds = client


def get_credentials(user):
    return UserCreds(
        access_token=user.spotify_access_token, refresh_token=user.spotify_refresh_token
    )