Skip to main content

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

Project description

asyncspotify

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

Installation

Simply install it from PyPi using pip!

pip install asyncspotify

Documentation

The official documentation can be found on readthedocs: https://asyncspotify.readthedocs.io/

Usage

The library provides easy to use authentication functions and intuitive method and hierarchies.

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 on 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.1.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asyncspotify-0.11.1-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: asyncspotify-0.11.1.tar.gz
  • Upload date:
  • Size: 20.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.7.5

File hashes

Hashes for asyncspotify-0.11.1.tar.gz
Algorithm Hash digest
SHA256 492e8853c2bf32dffa720b650beb1248e87a7e0a98e5faa5d635718dd76206a6
MD5 6c086a79224bd465fbb1e09ada46dc1a
BLAKE2b-256 58785813b98a676bfea1b0705cbd1b6388e2528d7ddbe64f3e7bd36eed0a447c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncspotify-0.11.1-py3-none-any.whl
  • Upload date:
  • Size: 27.7 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.7.5

File hashes

Hashes for asyncspotify-0.11.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6f8871354e9cfbdbf141c6da917902e290292724ed16ab8f1439a6472aee4b32
MD5 bf1d2c60e3a8b5461eaf7751dacacb13
BLAKE2b-256 5c565570a17f24315c5e9b6abfa64fdb4654c14064425fca7904ab9b0df65ad5

See more details on using hashes here.

Supported by

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