spotify/http.py
async def get_bearer_info(self):
        """Get the application bearer token from client_id and client_secret."""
        if self.client_id is None:
            raise SpotifyException(_GET_BEARER_ERR % 'client_id')

        elif self.client_secret is None:
            raise SpotifyException(_GET_BEARER_ERR % 'client_secret')

        token = b64encode(':'.join((self.client_id, self.client_secret)).encode())

        kwargs = {
            'url': 'https://accounts.spotify.com/api/token',
            'data': {'grant_type': 'client_credentials'},
            'headers': {'Authorization': 'Basic ' + token.decode()}
        }

        async with self._session.post(**kwargs) as resp:
            return json.loads(await resp.text(encoding='utf-8'))
async def get_bearer_info(self):
        if self.client_id is None:
            raise SpotifyException(_GET_BEARER_ERR % 'client_id')

        elif self.client_secret is None:
            raise SpotifyException(_GET_BEARER_ERR % 'client_secret')

        token = b64encode(':'.join((self.client_id, self.client_secret)).encode())

        kwargs = {
            'url': 'https://accounts.spotify.com/api/token',
            'data': {'grant_type': 'client_credentials'},
            'headers': {'Authorization': 'Basic ' + token.decode()}
        }

        async with self._session.post(**kwargs) as resp:
            return json.loads(await resp.text(encoding='utf-8'))
async def get_bearer_info ( self ) : if self . client_id is None : raise SpotifyException ( _GET_BEARER_ERR % 'client_id' ) elif self . client_secret is None : raise SpotifyException ( _GET_BEARER_ERR % 'client_secret' ) token = b64encode ( ':' . join ( ( self . client_id , self . client_secret ) ) . encode ( ) ) kwargs = { 'url' : 'https://accounts.spotify.com/api/token' , 'data' : { 'grant_type' : 'client_credentials' } , 'headers' : { 'Authorization' : 'Basic ' + token . decode ( ) } } async with self . _session . post ( * * kwargs ) as resp : return json . loads ( await resp . text ( encoding = 'utf-8' ) )
Get the application bearer token from client_id and client_secret.
Get the application bearer token from client_id and client_secret .