Skip to main content

An async spotify api client

Project description

AsyncSpotify

Unit Tests Codacy Badge codecov

Documentation

The full documentation can be viewed here.

Why should you use this library

  • 99% Code coverage
  • Completely async
  • Scales up to (theoretically) unlimited requests per second (this depends mostly on the spotify request limit)
  • Customize the timeout, maximal simultaneous request
  • Throws custom errors so you can catch a Token expiration or a rate limit violation easily
  • Gets rid of the client credential workflow if you provide spotify cookies
    • Good for automated testing

Installation

You need at least python3.6 to install the package

pip install async-spotify

Example

For more in depth examples take a look here or visit the documentation.

from async_spotify import Preferences, SpotifyApiClient, SpotifyAuthorisationToken

# Create a preferences object and load the preferences from env variables
preferences = Preferences()
preferences.load_from_env()

# Create a new Api client and pass the preferences
api = SpotifyApiClient(preferences, hold_authentication=True)

# Get the auth token with your code
code: str = "Your Spotify Code"
auth_token: SpotifyAuthorisationToken = await api.get_auth_token_with_code(code)

# Create a new client
await api.create_new_client(request_limit=1500)

# Start making queries with the internally saved token
album_tracks: dict = await api.albums.get_tracks('03dlqdFWY9gwJxGl3AREVy')

# If you pass a valid auth_token this auth_token will be used for making the requests
album_tracks: dict = await api.albums.get_tracks('03dlqdFWY9gwJxGl3AREVy', auth_token)

Tests

See here.

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

async-spotify-0.1.1.tar.gz (24.7 kB view details)

Uploaded Source

File details

Details for the file async-spotify-0.1.1.tar.gz.

File metadata

  • Download URL: async-spotify-0.1.1.tar.gz
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for async-spotify-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5abb1969dcfdb7bda638ffac4fc611e719f3992d891db28ddd5fe0266d3428bc
MD5 052f79eeac1ebebc2ad53282ca5371fb
BLAKE2b-256 cc4b166a34f65421372be985e0f0b3892d68b2595e7bd306e36a605efb4b0bb1

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