Spotify API Reference#

SpotifyClient#

class lavapy.ext.spotify.SpotifyClient(clientID: str, clientSecret: str)#

Provides an interface for easily initialising and communicating with Spotify.

Parameters
  • clientID (str) – The Spotify client ID of the application you want to connect to.

  • clientSecret (str) – The Spotify client secret of the application you want to connect to.

async close() None#

This function is a coroutine.

Stops the sessions used for communicating with Spotify.

property accessToken: Optional[str]#

Returns the access token used to authenticate with Spotify.

property authHeaders: Dict[str, str]#

Returns the headers used for authenticating Spotify requests.

property clientID: str#

Returns the client ID of the Spotify client.

property clientSecret: str#

Returns the client secret of the Spotify client.

property session: aiohttp.client.ClientSession#

Returns the session used for communicating with Spotify.

Playables#

DecodeQuery#

lavapy.ext.spotify.decodeSpotifyQuery(query: str) Type[lavapy.tracks.Playable]#

Decodes a query into a Playable type which can be searched.

Parameters

query (str) – The query to decode.

Returns

The playable type which can be searched.

Return type

Type[Playable]

SpotifyBase#

class lavapy.ext.spotify.SpotifyBase(*data: Any)#

Bases: lavapy.tracks.Playable

A class which abstracts away a couple functions used for all Spotify resources.

SpotifyTrack#

class lavapy.ext.spotify.SpotifyTrack(id: str, info: Dict[str, Any])#

Bases: lavapy.tracks.Track, lavapy.ext.spotify.tracks.SpotifyBase

A track created using a search to Spotify.

SpotifyPlaylist#

class lavapy.ext.spotify.SpotifyPlaylist(name: str, tracks: List[lavapy.tracks.Track])#

Bases: lavapy.tracks.MultiTrack, lavapy.ext.spotify.tracks.SpotifyBase

A playlist created using a search to Spotify.

SpotifyAlbum#

class lavapy.ext.spotify.SpotifyAlbum(name: str, tracks: List[lavapy.tracks.Track])#

Bases: lavapy.tracks.MultiTrack, lavapy.ext.spotify.tracks.SpotifyBase

An album created using a search to Spotify.

Exceptions#

exception lavapy.ext.spotify.SpotifyAuthException#

Bases: lavapy.exceptions.LavapyException

Exception raised when an error occurred while authorising with Spotify.