Skip to main content

Client for interacting with the Spotify API

Project description

spotify-client

Client for interacting with the Spotify API

Usage

First install the package with pip:

pip install spotify-client

Then import the client for usage in your application:

from spotify_client import SpotifyClient

SPOTIFY_CLIENT_ID = 'client_id_from_spotify'
SPOTIFY_SECRET_KEY = 'secret_key_from_spotify'

client = SpotifyClient(SPOTIFY_CLIENT_ID, SPOTIFY_SECRET_KEY, identifier='test-spotify-client')

You'll need to generate your client ID and secret keys for authenticating with Spotify from their API console. You can find the steps for doing that in the Spotify documentation.

The client will make a request to generate the access_token the first time it makes a call to the API. It will then cache the access token as an instance variable, to use in future requests by that client instance. This avoids the overhead of having to make a request for the access token on each request to the API.

You can optionally pass an identifier to the constructor. This will be used in logging messages by the client to uniquely identify logs for the client instance.

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

spotify-client-0.0.1.tar.gz (10.9 kB view hashes)

Uploaded Source

Built Distribution

spotify_client-0.0.1-py3-none-any.whl (13.4 kB view hashes)

Uploaded Python 3

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