Skip to content

A extremely minimal client library for some portions of the spotify web api

License

Notifications You must be signed in to change notification settings

HarryShomer/spotify-web-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spotify Web API

A extremely minimal client library for some portions of the spotify web api which only implements the clients credentials flow.

Install

It's currently not on pip. Therefore to install it on your machine either clone or download the repository and run either:

pip setup.py install

or if you are interested in modifying it

pip setup.py develop

Supported APIs

As of right now only the following sections of the API are supported:

The following sections of the API aren't covered:

Usage

As of right now only the client credentials flow is supported. To use this you must have a spotify Client ID and Client Secret. You can get those by registering here.

I recommend setting these two as environment variables on your computer which will cause the the library to automatically find them. You will need to set them equal to SPOTIFY_ID and SPOTIFY_SECRET. This can be done by modifying your .bash_profile and adding

export SPOTIFY_ID="Your ID"
export SPOTIFY_SECRET="Your Secret key"

You can then just do:

from spotify_web_api import Spotify

spy = Spotify()

You can also pass the two through the constructor when you create a Spotify object:

from spotify_web_api import Spotify

SPOTIFY_ID = "Your Client Id"
SPOTIFY_SECRET = "Your secret key"

spy = Spotify(client_id=SPOTIFY_ID, client_secret=SPOTIFY_SECRET)

Examples

Get the all tracks for an album

spy.get_album_tracks("time will die and love will bury it")

Get all the albums (only LPs) for a specific artist

spy.get_artist_albums("converge", include_groups="album")

Get all the spotify playlists for a specific category

spy.get_category_playlists("rock")

Get the audio features for several tracks

tracks = ['beauty in falling leaves', 'me & my dog']
spy.get_audio_features(tracks)

Search for a specific track, album, artist, or playlist

spy.search("imperial triumphant", "artist")

Tests

To run the tests you will need to have pytest installed. Once you do, go over to the tests directory and run

pytest -v

Contribute

Please feel free to fork this or submit a pull request. There are obviously quite a lot of parts of the api this is missing so implement it if you want. If you do choose to submit a pull request please write the appropriate tests for the added features.

About

A extremely minimal client library for some portions of the spotify web api

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages