spotify.py
An API library for the spotify client and the Spotify Web API written in Python.
Spotify.py is an, primarily, asyncronous library (everything down to the HTTP client is asyncio friendly).
Sync' support
The library also supports syncronous usage with spotify.sync
import spotify.sync as spotify # Nothing requires async/await now!
example
- Sorting a playlist by popularity
import spotify
playlist_uri = # Playlist uri here
client_id = # App client id here
secret = # App secret here
token = # User token here
client = spotify.Client(client_id, secret)
async def main():
user = await spotify.User.from_token(client, token)
playlist = next(filter((lambda playlist: playlist.uri == playlist_uri), await user.get_playlists()))
tracks = await playlist.get_all_tracks()
sorted_tracks = sorted(tracks, reverse=True, key=(lambda track: track.popularity))
await user.replace_tracks(playlist, sorted_tracks)
if __name__ == '__main__':
client.loop.run_until_complete(main())
Installing
To install the library simply clone it and run setup.py
git clone https://github.com/mental32/spotify.pypython3 setup.py install
or use pypi
pip3 install spotify(latest stable)pip3 install -U git+https://github.com/mental32/spotify.py(nightly)
Resources
Metadata
Release files for spotify 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| spotify-0.5.0.tar.gz | 31.1 kB | Without provenance | Details |
Release files / spotify-0.5.0.tar.gz
| Download URL | spotify-0.5.0.tar.gz |
|---|---|
| Size | 31.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2d43362ac71a36f8b39e5f9146f209fafd89a40c627f662e16692aa549761628
|
|
BLAKE2b-256 checksum How to use checksums |
798df4d6c8b42d5c5507768ba4b0f528b44edaa5f648e4abffe4ab134561b096
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.4
|
Security for spotify 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.