コード例 #1
0
 def _get_auth_response_local_server(self, redirect_port):
     logger.warning(
         "Interactive function `_get_auth_response_local_server()` called but ignored."
     )
     raise SpotifyOauthError(
         "Interactive function `_get_auth_response_local_server()` called but ignored."
     )
コード例 #2
0
 def _get_auth_response_interactive(self, open_browser=False):
     logger.warning(
         "Interactive function `_get_auth_response_interactive()` called but ignored."
     )
     raise SpotifyOauthError(
         "Interactive function `_get_auth_response_interactive()` called but ignored."
     )
コード例 #3
0
    def get_cached_token(self):
        """ Gets a cached auth token
        """
        token_info = None
        try:
            token_info_string = get_spotify_token_info(self.discord_uid)
            token_info = json.loads(token_info_string)

            # if scopes don't match, then bail
            if "scope" not in token_info or not self._is_scope_subset(
                    self.scope, token_info["scope"]):
                return None

            if self.is_token_expired(token_info):
                token_info = self.refresh_access_token(
                    token_info["refresh_token"])
        except Exception as e:
            logger.warning(f"Couldn't read cache: {e}")

        return token_info
コード例 #4
0
 def _open_auth_url(self):
     logger.warning(
         "Interactive function `_open_auth_url()` called but ignored.")
コード例 #5
0
 def _save_token_info(self, token_info):
     try:
         add_or_update_spotify_token_info(uid=self.discord_uid,
                                          token_info=json.dumps(token_info))
     except Exception as e:
         logger.warning(f"Couldn't read cache: {e}")