spotifywebapipython.spotifywebplayertoken

SPOTIFY_WEBUI_URL_GET_ACCESS_TOKEN = 'https://open.spotify.com/get_access_token'

Url used to get access token.

class SpotifyWebPlayerToken:

Represents a Spotify web player token for an account.

SpotifyWebPlayerToken( clientId: str = None, profileId: str = None, tokenProviderId: str = None, tokenStorageDir: str = None, tokenStorageFile: str = None)

Initializes a new instance of the class.

Arguments:
  • clientId (str): The unique identifier of the application. A null value will default to Shared.
    Default: Shared
  • profileId (str): Profile identifier used when loading / storing the token to disk.
    A null value will default to Shared.
    Default: Shared
  • tokenProviderId (str): Provider identifier used when storing the token to disk. A null value will default to Shared.
    Default: Shared
  • tokenStorageDir (str): The directory path that will contain the Token Cache file.
    A null value will default to the platform specific storage location:
    Example for Windows OS = C:\ProgramData\SpotifyWebApiPython
  • tokenStorageFile (str): The filename and extension of the Token Cache file.
    Default is tokens.json.
AccessToken: str

An access token that can be provided to a Spotify Web Player application.

ClientId: str

The unique identifier of the application.

ExpiresAt: int

DateTime (in epoch seconds) that the authorization token will expire.

ExpireDateTimeUtc: datetime.datetime

DateTime (in UTC format) that the authorization token will expire.

ExpiresIn: int

The time period (in seconds) for which the access token is valid.

IsExpired: bool

Returns true if the token has expired; otherwise, False if not expired.

ProfileId: str

Profile identifier used when loading / storing the token to disk.

def GetAccessTokenFromCookieCredentials(self) -> None:

Get Spotify Web Player access token from stored Spotify Web Player cookie credentials.

This will create a new session to the "https://open.spotify.com" url, passing it the stored cookie credentials.