async def test_and_get_me_attr_attr_exists_async(): spt = AsyncSpotify() spt.user_creds = UserCreds() spt.user_creds.id = "id1234" assert await _set_and_get_me_attr_async(spt, "id") == "id1234"
def async_spotify_user_auth(): spotify = AsyncSpotify() 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
def test_oauth_uri_raises_deprecation_warning(): creds = ClientCreds(client_id='asdasdasdasdads', client_secret='asdasdasdasdasd', scopes=['asdasd', 'asdasd'], redirect_uri='asdasdasdasd') sync = Spotify(client_creds=creds) async_ = AsyncSpotify(client_creds=creds) with pytest.warns(DeprecationWarning): sync.oauth_uri with pytest.warns(DeprecationWarning): async_.oauth_uri
def async_spotify_client_auth(): spotify = AsyncSpotify() client_creds = ClientCreds() client_creds.load_from_env() spotify.client_creds = client_creds yield spotify
from pyfy import AsyncSpotify, ClientCreds, AuthError try: from spt_keys import KEYS except: # noqa: E722 from spt_keys_template import KEYS app = Sanic(__name__) local_address = "localhost" local_port = "5000" local_full_address = local_address + ":" + str(local_port) spt = AsyncSpotify() client = ClientCreds() state = "123" @app.route("/authorize") def authorize(request): export_keys() client.load_from_env() spt.client_creds = client if spt.is_oauth_ready: return response.redirect(spt.auth_uri(state=state)) else: return ( json( {