Spotify Web API implementation that is fully asynchronous and object-oriented.
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file asyncspotify-0.11.8.tar.gz
.
File metadata
- Download URL: asyncspotify-0.11.8.tar.gz
- Upload date:
- Size: 24.9 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ee5e3e0a929dcf75a24208c9887f44e71bdd6f3a927e44063274d8b8f4371df |
|
MD5 | b7916c7dbb02f737c30251894990149c |
|
BLAKE2b-256 | fa70954ae9d17b9a1096b46c4fb97d42a710a2eea1145a78650fce8c348e86ac |
File details
Details for the file asyncspotify-0.11.8-py3-none-any.whl
.
File metadata
- Download URL: asyncspotify-0.11.8-py3-none-any.whl
- Upload date:
- Size: 31.9 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa3974e84c85932f9727eba3bf47b6494d400630253ce07a54e8f8677d81168e |
|
MD5 | e454bbf840fe000b307b40ca37d1e257 |
|
BLAKE2b-256 | 1c430bc5a681b78a57b983dedf184750797633f1d0587d71573ff50cf4d42c97 |