Exemplo n.º 1
0
from pyfy import Spotify


from pyfy import ClientCreds, Spotify
#

client_id ="2c0d0c49b20c4a2cbe346f42bb6dab74"
client_secret ="811e8611fafc4683b415caae2814d98b"
redirect_uri = 'http://localhost/'

username = "******"
scope = 'user-read-playback-state user-library-modify'


client = ClientCreds(client_id=client_id, client_secret=client_secret)
spt = Spotify(client_creds=client)
print(spt.auth_uri(client_id=client_id,scopes=scope.split(" "),redirect_uri=redirect_uri,show_dialog=True))
authcode=input().strip()

spt.build_user_creds(grant=authcode)
Exemplo n.º 2
0
def authorize(spotify: Spotify) -> None:
    print(spotify.auth_uri())

    code = wait_for_code()

    spotify.build_user_creds(grant=code, set_user_creds=True)