Skip to main content

Spotify Web API implementation that is fully asynchronous and object-oriented.

Project description

PyPI version info RTD 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:

from asyncspotify import Client, ClientCredentialsFlow

auth = ClientCredentialsFlow(
   client_id='your client id',
   client_secret='your client secret',
)

async with Client(auth) as sp:
   playlist = await sp.get_playlist('1MG01HhbCvVhH9NmXhd9GC')
   for track in playlist.tracks:
      print(track.name)

Searching for and getting tracks:

results = await sp.search_tracks(q='involvers', limit=2)
# [<SimpleTrack id='5xoJhWwvzPJD9k8j8BE2xO' name='27'>, <SimpleTrack id='0WUTBejxPUhURFCFfSYbDc' name='Fighting My Fight'>]

track = await sp.get_track('0hqAWKZDhuOfFb6aK002Ph')
# <FullTrack id='0hqAWKZDhuOfFb6aK002Ph' name='Bone Dry'>

Fetching and creating playlists:

# get a playlist
playlist = await sp.get_playlist('1wPvaRtuI8mt10CpP2KnlO')
# <FullPlaylist id='1wPvaRtuI8mt10CpP2KnlO' name='my playlist'>

# iterate through playlist tracks
for track in playlist.tracks:
   print(track)

# get current user
me = await sp.get_me()
# <PrivateUser id='runie13'>

# create new playlist
my_playlist = await me.create_playlist(name='My playlist!')
# <FullPlaylist id='0YTCnj0WE5gGb1lRqD6Ks9' name='My playlist!'>

# add tracks from previews playlist to the new playlist
await my_playlist.add_tracks(*playlist.tracks)

Reporting bugs

Please report issues here at GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asyncspotify-0.11.6.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

asyncspotify-0.11.6-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

Details for the file asyncspotify-0.11.6.tar.gz.

File metadata

  • Download URL: asyncspotify-0.11.6.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0

File hashes

Hashes for asyncspotify-0.11.6.tar.gz
Algorithm Hash digest
SHA256 482c7801d2056f949c25b6396cc705a63540f4a49e6882488e11e22ecad9dd62
MD5 1a085e0562435fa8774d657ab94d3182
BLAKE2b-256 25f5c2a82a50ff5e6880924941f2e70268eea459c8d597a76850098ea47b410d

See more details on using hashes here.

File details

Details for the file asyncspotify-0.11.6-py3-none-any.whl.

File metadata

  • Download URL: asyncspotify-0.11.6-py3-none-any.whl
  • Upload date:
  • Size: 31.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0

File hashes

Hashes for asyncspotify-0.11.6-py3-none-any.whl
Algorithm Hash digest
SHA256 03ab5901e537b47670bc844747eddcc7c0136ac17b7c08100e2be10ac8a41a76
MD5 dbcea16ae3e5fe776f1e18a18c3a733b
BLAKE2b-256 379430e77ac3bfbf829d4489bb38867a5d6a06cdedf9d1f105840a8f7ff27e4b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page