Skip to content

Repository files navigation

asyncspotify

PyPI version infoRTD Documentation

asyncspotify is an asynchronous, object-oriented python wrapper for the Spotify Web API.

Installation

Simply install the library from PyPI:

python -m pip install asyncspotify

Documentation

The documentation can be found at readthedocs.

Usage

To get going quickly, read the quickstart.

For complete examples, please check the documentation. Here's some snippets:

Authenticating using the Client Credentials flow, and getting a playlist:

fromasyncspotifyimportClient, ClientCredentialsFlowauth=ClientCredentialsFlow(
client_id='your client id',
client_secret='your client secret',
)
asyncwithClient(auth) assp:
playlist=awaitsp.get_playlist('1MG01HhbCvVhH9NmXhd9GC')
asyncfortrackinplaylist:
print(track.name)

Searching for and getting tracks:

results=awaitsp.search_tracks(q='involvers', limit=2)
# [<SimpleTrack id='5xoJhWwvzPJD9k8j8BE2xO' name='27'>, <SimpleTrack id='0WUTBejxPUhURFCFfSYbDc' name='Fighting My Fight'>]track=awaitsp.get_track('0hqAWKZDhuOfFb6aK002Ph')
# <FullTrack id='0hqAWKZDhuOfFb6aK002Ph' name='Bone Dry'>

Fetching and creating playlists:

# get a playlistplaylist=awaitsp.get_playlist('1wPvaRtuI8mt10CpP2KnlO')
# <FullPlaylist id='1wPvaRtuI8mt10CpP2KnlO' name='my playlist'># iterate through playlist tracksfortrackinplaylist.tracks:
print(track)
# get current userme=awaitsp.get_me()
# <PrivateUser id='runie13'># create new playlistmy_playlist=awaitme.create_playlist(name='My playlist!')
# <FullPlaylist id='0YTCnj0WE5gGb1lRqD6Ks9' name='My playlist!'># add tracks from previews playlist to the new playlistawaitmy_playlist.add_tracks(*playlist.tracks)

Reporting bugs

Please report issues here at GitHub.

About

Asynchronous and object-oriented wrapper for the Spotify Web API written in Python

Resources

Stars

15 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages