Skip to main content

Simple-Spotify

Pure Python wrapper library for Spotify Web API.

Installation

pip install simple-spotify

Quick Start

from simple_spotify.api import Spotify
from simple_spotify.authorization import ClientCredentialsFlow

res = ClientCredentialsFlow.token_request(
    'YOUR CLIENT ID',
    'YOUR CLIENT SECRET'
)

auth = ClientCredentialsFlow(**res)
sp = Spotify(auth)

result = sp.search(q='sora tob sakana')

for album in result.albums.items:
    print(album.name)
sora tob sakana
cocoon ep
yozora wo zenbu
mahou no kotoba

If you execute endpoint which need AutotizationCodeFlow on your local envirnoment tempolary, authcode-fetch will be help you.

$ authcode-fetch

    =============================================
                    Simple-Spotify
        Authorization Code Flow Support Tool
    =============================================

    Fetch authorization code from https://accounts.spotify.com/authorize.
    Output json file named simple-spotify_code.json.
    This json file includes client_id, client_secret, authorization code, redirect uri.
    Format of json file as follows.
    {
        'client_id': client_id,
        'client_secret': client_secret,
        'code': authorization code,
        'redirect_uri': redirect_uri
    }

Enter the your Client ID : YOUR CLIENT ID
Enter the your Client Secret : YOUR CLIENT SECRET
Enter the redirect URI :http://127.0.0.1:8080/
Enter the scopes
Scope :user-read-birthdate
Add more scope ?(y/n) :n
# Open your default browser. Log in, authorize access
Enter the redirected URL : REDIRECTED URL

Then, simple-spotify_code.json generate on your current directory.

import json

from simple_spotify.api import Spotify
from simple_spotify.authorization import AuthorizationCodeFlow

with open('simple-spotify_code.json') as f:
    auth_dict = json.load(f)

res = AuthorizationCodeFlow.token_request(**auth_dict)
auth = AuthorizationCodeFlow(**res)
sp = Spotify(auth)

current_user = sp.get_current_user_profile()

Version

  • v.0.1.0 (May 09, 2019): Initial release:

  • v.0.1.1 (May 10, 2019): Create sample web app, fix authorization.py

  • v.0.1.2 (May 10, 2019): Upload to PyPI

  • v.0.1.3 (May 11, 2019): Bugfix on simple_spotify.api

  • v.0.1.4 (May 17, 2019): Added keyword argument market to following methods. get_album , get_albums, get_track, get_tracks

Metadata

Release files for simple-spotify 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-spotify 0.1.4
File Size Uploaded
simple_spotify-0.1.4.tar.gz 15.2 kB Details

Release files / simple_spotify-0.1.4.tar.gz

Download URL simple_spotify-0.1.4.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b1c555f8abcbc67845737ad009d0155e4eef13d2c778531d5471673961938124
BLAKE2b-256 checksum
How to use checksums
420d7d132728ea1d4eaf711616cc321e6d8a23864136cc195bc152d9c3ad6575
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0

Release history Release notifications | RSS feed

This release

0.1.4 This release

1 release file

0.1.3

1 release file

0.1.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page