def spotify_client(config): client = web.SpotifyOAuthClient( client_id=config["spotify"]["client_id"], client_secret=config["spotify"]["client_secret"], proxy_config=None, ) client.user_id = "alice" return client
def test_configures_proxy(self): proxy_config = { "scheme": "https", "hostname": "my-proxy.example.com", "port": 8080, "username": "******", "password": "******", } client = web.SpotifyOAuthClient(client_id=None, client_secret=None, proxy_config=proxy_config) assert (client._session.proxies["https"] == "https://*****:*****@my-proxy.example.com:8080")
def on_start(self): self._actor_proxy = self.actor_ref.proxy() self._session = self._get_session(self._config) self._event_loop = spotify.EventLoop(self._session) self._event_loop.start() self._session.login( self._config["spotify"]["username"], self._config["spotify"]["password"], ) self._web_client = web.SpotifyOAuthClient( client_id=self._config["spotify"]["client_id"], client_secret=self._config["spotify"]["client_secret"], proxy_config=self._config["proxy"], ) self._web_client.login() if self.playlists is not None: self.playlists.refresh()
def test_configures_auth(self): client = web.SpotifyOAuthClient(client_id="1234567", client_secret="AbCdEfG", proxy_config=None) assert client._auth == ("1234567", "AbCdEfG")
def spotify_client(config): return web.SpotifyOAuthClient( client_id=config["spotify"]["client_id"], client_secret=config["spotify"]["client_secret"], proxy_config=None, )