A light weight Python library for the Spotify Web API

Overview

Spotipy

A light weight Python library for the Spotify Web API

Tests Documentation Status

Documentation

Spotipy's full documentation is online at Spotipy Documentation.

Installation

pip install spotipy

or upgrade

pip install spotipy --upgrade

Quick Start

A full set of examples can be found in the online documentation and in the Spotipy examples directory.

To get started, install spotipy and create an app on https://developers.spotify.com/. Add your new ID and SECRET to your environment:

Without user authentication

import spotipy
from spotipy.oauth2 import SpotifyClientCredentials

sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials(client_id="YOUR_APP_CLIENT_ID",
                                                           client_secret="YOUR_APP_CLIENT_SECRET"))

results = sp.search(q='weezer', limit=20)
for idx, track in enumerate(results['tracks']['items']):
    print(idx, track['name'])

With user authentication

import spotipy
from spotipy.oauth2 import SpotifyOAuth

sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id="YOUR_APP_CLIENT_ID",
                                               client_secret="YOUR_APP_CLIENT_SECRET",
                                               redirect_uri="YOUR_APP_REDIRECT_URI",
                                               scope="user-library-read"))

results = sp.current_user_saved_tracks()
for idx, item in enumerate(results['items']):
    track = item['track']
    print(idx, track['artists'][0]['name'], " – ", track['name'])

Reporting Issues

For common questions please check our FAQ.

You can ask questions about Spotipy on Stack Overflow. Don’t forget to add the Spotipy tag, and any other relevant tags as well, before posting.

If you have suggestions, bugs or other issues specific to this library, file them here. Or just send a pull request.

Comments
  • Choosing a new home for Spotipy

    Choosing a new home for Spotipy

    Hello again! Plamere has been inactive for a long time so Spotipy has been transferred to my name on PyPI and Read The Docs. In #404 we decided to continue the development of Spotipy. Now it's time to discuss where.

    Original issue: Is under development?

    In August there was a long discussion in #387 on whether this project was abandoned or not. A number of alternatives were also declared as in development. I thought it would be fair to mention them here and include them in the list of considerations. In the order of announcement they were:

    The current discussion

    We should discuss where the new home of Spotipy should be. That can be one of the repositories above or elsewhere if another one is announced. An appropriate time frame for the transfer should also be chosen, meaning a period where the information about the transfer is available but the package is still in its original state. The transfer is then announced in a separate issue.

    State your case below. Please link to the repository, introduce it and argue why it should be chosen over other options that are presented.

    Please vote or comment on versions even if you have not written one!

    opened by felix-hilden 34
  • 'Search' funtion does not retrieve all playlists

    'Search' funtion does not retrieve all playlists

    Describe the bug When 'Search' function is used to query playlists matching certan key words, the results do not contain playlists, which are available on official web page of spotify. The search query is the same. While in results of Official Webpage of Spotify I can see playlists, created by Spotify (where owner of playlist is user with id=spotify), in results of Spotipy Library with the same search query, I sometimes get playlists created by Spotify user, sometimes I do not get any.

    Your code

    playlists = []
    for offset in range(0, 1000, 50):
      playlists = playlists + spotify.search(q="Folk punk", limit=50, offset=offset, type='playlist').get('playlists')['items']
    

    Expected behavior I expect to retrieve from Spotipy the same results that I can get from Spotify Web Page.

    Output (https://open.spotify.com/search/Folk%20punk/playlists) - here is the output that I expect to see.

    Environment:

    • OS: Windows
    • Python version 3.7.0
    • spotipy version 2.19.0
    • Google Colab

    Additional context Additionally, I checked function from Spotipy - user_playlists. While on https://open.spotify.com/user/spotify page I can see that Spotify user has 1520 public playlists, with almost the same code:

    spotify_playlists = []
    for offset in range(0, 2000, 10):
      spotify_playlists = spotify_playlists + spotify.user_playlists(user = 'spotify', limit=10, offset=offset)['items']
    print(len(spotify_playlists))
    

    I am getting less number of playlists (1177) Is there something that I missed?

    bug 
    opened by KamranAbbaszadeIbrahim 28
  • Old version on pip/easy_install installation

    Old version on pip/easy_install installation

    I believe there is an issue with spotipy pip and easy_install installation. I installed the library today through both install methods, but both came with old versions of the source code. I noticed some lines in spotipy/oauth2.py that were different from the most current version. The discrepancy is from a change made in a Jan 2017 commit that fixed a scope issue. My installation versions with pip and easy_install both did not have this fix.

    This could easily just be me and my own mistakes, but I wanted to see if others were having a similar issue. Other than this I've been loving the API wrapper :)

    opened by dransho1 24
  • AttributeError: 'NoneType' object has no attribute 'split' when calling util.prompt_for_user_token with a cached token of None scope

    AttributeError: 'NoneType' object has no attribute 'split' when calling util.prompt_for_user_token with a cached token of None scope

    Minimal example:

    from spotipy.util import prompt_for_user_token
    token = prompt_for_user_token(some_username, None, some_client_id, some_client_secret, some_redirect_uri)
    # Now a cached token with None scope exists
    token2 = prompt_for_user_token(some_username, None, some_client_id, some_client_secret, some_redirect_uri)
    # AttributeError occurs
    

    (Note scope=None is default for util.prompt_for_user_token()) Traceback:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "$PYTHONPATH$\lib\site-packages\spotipy\util.py", line 56, in prompt_for_user_token
        token_info = sp_oauth.get_cached_token()
      File "$PYTHONPATH$\lib\site-packages\spotipy\oauth2.py", line 135, in get_cached_token
        if 'scope' not in token_info or not self._is_scope_subset(self.scope, token_info['scope']):
      File "$PYTHONPATH$\lib\site-packages\spotipy\oauth2.py", line 156, in _is_scope_subset
        needle_scope = set(needle_scope.split())
    AttributeError: 'NoneType' object has no attribute 'split'
    

    This breaks the program when being runned a second time with existence of cache on disk, which previously (back before last December I believe) did not happen.

    bug wontfix 
    opened by jj1118 23
  • Offset field not working for user_playlist_tracks(), wrong response back

    Offset field not working for user_playlist_tracks(), wrong response back

    I'm getting an odd issue where I'm not retrieving the response that I'm expecting when calling user_playlist_tracks() to retrieve tracks from a playlist. I still retrieve the songs, but the paging object I receive back is incorrect, which is also preventing the 'limit' and 'offset' field from being set correctly, since they are now located in the 'track' object that gets returned.

    According to the spotify docs: https://developer.spotify.com/documentation/web-api/reference/playlists/get-playlists-tracks/

    I should be receiving a paging object like such:

    {
      "href": "",
      "items": [ ],
      "limit": 0,
      "next": "",
      "offset": 0,
      "previous": "",
      "total" 0
    }
    

    Instead, I am receiving this:

    { 
      "collaborative": False,
      "description": "",
      "external_urls": {},
      "followers": {},
      "href": "",
      "id": "",
      "images": [],
      "name": "",
      "owner": {},
      "primary_color": null,
      "public": False
      "snapshot_id": "",
      "tracks": {},
      "type": "",
      "uri": "",
      "len": 0
    }
    

    Where the tracks object contains the paging object that I am actually expecting according to the Spotify docs above.

    I am aware that this used to work properly since I have previously implemented code to retrieve all the tracks from my playlists, but for some reason, the response I'm getting back now with identical code is different. I'm not sure if this is something that has changed on Spotipy's end or the Spotify API.

    opened by AndrewKassab 22
  • How to run entirely in a script? (no redirect url)

    How to run entirely in a script? (no redirect url)

    I'm trying to use this library to get recently played information from the API, and I will want this script to run automatically without any user intervention. Is it possible to do that with this library? Right now this is my code:

    from spotipy.oauth2 import SpotifyOAuth
    token = SpotifyOAuth(
    	SPOTIFY_CLIENT_ID,
    	SPOTIFY_CLIENT_SECRET,
    	'localhost:8000',
    	scope='user-read-recently-played',
    	username='vacd7qnn09sx0dtj56qtwmix7'
    	)
    

    However when I run this it tries to open a window in my browser to get authentication working. The localhost:8000 url is fake, I don't actually have anything there, I just put it in so it would stop complaining about not receiving a redirect url.

    What's the way to have this run without requiring manual intervention? I need this script to run by itself entirely. It seems that having the ID and secret should be enough...

    question documentation 
    opened by PAK90 19
  • Refreshing a token with authorization code flow

    Refreshing a token with authorization code flow

    I have a long-running script using spotipy. After an hour (per the Spotify API), my access token expires. I am catching this successfully, but I don't know where to go from there in regards to actually refreshing the token. I am using the authorization code flow, not client credentials. Here's how I authorize:

    `token = util.prompt_for_user_token(username,scope=scopes,client_id=client_id,client_secret=client_secret, redirect_uri=redirect_uri)

    sp = spotipy.Spotify(auth=token)`

    All refresh examples I've seen involve an oauth2 object (ex. oauth.refresh_access_token()), and the docs list only that function as a method of refreshing your token. It's my understanding that with authorization code flow, you don't need an oauth object (because you authenticate with prompt_for_user_token(). If that's the case, how do I refresh my token?

    enhancement 
    opened by nhend 19
  • "401 error: The access token expired" when using SpotifyClientCredentials

    I am creating my Spotipy object like this, after reading this code snippet:

    scc = SpotifyClientCredentials(client_id = SPOTIPY_CLIENT_ID,
                                       client_secret = SPOTIPY_CLIENT_SECRET)
    sp = spotipy.Spotify(client_credentials_manager = scc)
    

    However, after a number of queries, I obtain the following error:

    http status:401                                                                 
    Traceback (most recent call last):                                              
      File "retriever2.py", line 114, in <module>                                   
        store_songs(terms, dbfile, total_number)                                    
      File "retriever2.py", line 97, in store_songs                                 
        songs = get_songs(sp, playlist)                                             
      File "retriever2.py", line 36, in get_songs                                   
        track_results = sp.next(track_results)                                      
      File "/home/chema/.local/lib/python2.7/site-packages/spotipy/client.py", line 172, in next
        return self._get(result['next'])                                            
      File "/home/chema/.local/lib/python2.7/site-packages/spotipy/client.py", line 123, in _get
        return self._internal_call('GET', url, payload, kwargs)                     
      File "/home/chema/.local/lib/python2.7/site-packages/spotipy/client.py", line 104, in _internal_call
        -1, '%s:\n %s' % (r.url, r.json()['error']['message']))                     
    spotipy.client.SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/users/1248788010/playlists/4wEVX1M28mBIpiHttM6PrP/tracks?offset=100&limit=100:
     The access token expired      
    

    I was under the impression that SpotifyClientCredentials was used to update the access token accordingly. Right now, I have my queries inside a try - except block and I refresh it manually (I basically recreate the sp object every time I get an exception). Am I using this correctly or is there any other way?

    opened by rinze 17
  • Auto-refresh AuthCode flow token.

    Auto-refresh AuthCode flow token.

    opened by stefanondisponibile 16
  • Is it possible to create a playlist of every song an artist ID has and appears on (including appears on section)?

    Is it possible to create a playlist of every song an artist ID has and appears on (including appears on section)?

    Several apps that claim to do this, like for example alfred spotify mini player that says creates complete collection misses many songs, mostly the appears on sections, which it cannot penetrate, but that is where artists frequently appear on remixes etc.

    searching in spotify and sorting by songs is messy too, and often includes junk and songs not by that artist as it runs out of songs by the artist.

    Is there a way to run a script that will return a list of all songs if I put in the artist name (ID?), regardless of dupes, just a total list, this would be helpful for grass cutting for updates every few weeks or so, as the big apps that update new releases are annoying and sporadic. I want to do it when I want to do it.

    Would it be easy or hard, as you can probably tell I'm not a coder but have some money left on freelancer I'd rather spend than try to claw back.

    I think this is the relevant section.

    playlist_add_items(playlist_id, items, position=None) Adds tracks/episodes to a playlist

    Parameters: playlist_id - the id of the playlist items - a list of track/episode URIs, URLs or IDs position - the position to add the tracks

    thanks.

    question 
    opened by greeneryAO 15
  • retrieve proper message and reason when response can't be loaded to json

    retrieve proper message and reason when response can't be loaded to json

    I couldn't reproduce the throwing of BrokenPipeError reported in #633, but noticed that the SpotifyException that was being thrown instead had None as reason. I then noticed that both msg and reason could possibly be retrieved from the response's raw, so I created a method to do it (only if loading to json fails). I also extracted a method from the original code.

    opened by gustavopcassol 15
  • Folder creation : failed ( operation not permitted)

    Folder creation : failed ( operation not permitted)

    Describe the bug installed spotipy in ipad ( 9 gen) Application : Carnets ( ipython )

    Your code

    File "/var/mobile/Containers/Data/Application/5A0F27B7-CFC5-4EF3-A1EF-41514180F426/Library/lib/python3.11/site-packages/spotdl/utils/spotify.py", line 18, in from spotdl.utils.config import get_cache_path File "/var/mobile/Containers/Data/Application/5A0F27B7-CFC5-4EF3-A1EF-41514180F426/Library/lib/python3.11/site-packages/spotdl/utils/config.py", line 131, in "cache_path": str(get_cache_path()), ^^^^^^^^^^^^^^^^ File "/var/mobile/Containers/Data/Application/5A0F27B7-CFC5-4EF3-A1EF-41514180F426/Library/lib/python3.11/site-packages/spotdl/utils/config.py", line 67, in get_cache_path return get_spotdl_path() / ".spotipy" ^^^^^^^^^^^^^^^^^ File "/var/mobile/Containers/Data/Application/5A0F27B7-CFC5-4EF3-A1EF-41514180F426/Library/lib/python3.11/site-packages/spotdl/utils/config.py", line 43, in get_spotdl_path os.mkdir(spotdl_path) PermissionError: [Errno 1] Operation not permitted: '/private/var/mobile/Containers/Data/Application/5A0F27B7-CFC5-4EF3-A1EF-41514180F426/.spotdl'

    Expected behavior Replace cache folder without “.” In it

    question 
    opened by prudhvi00 1
  • TypeError in oauth2

    TypeError in oauth2

    In file spotipy/oauth2.py in Class SpotifyAuthBase method __del__. Both arguments were of different types.

    File "C:\Storage\Python Programs\project_vid_ed\.vEnv\lib\site-packages\spotipy\oauth2.py", line 156, in __del__
    TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union
    

    Before the code was:

    def __del__(self):
            """Make sure the connection (pool) gets closed"""
            if isinstance(self._session,requests.Session):
                self._session.close()
    

    After fixing:

    def __del__(self):
            """Make sure the connection (pool) gets closed"""
            # print(type(self._session))
            if isinstance(type(self._session),type(requests.Session)):
                self._session.close()
    

    Environment:

    • OS: Windows 11
    • Python version: 3.10.4
    • spotipy version: 2.21.0
    • IDE: Visual Studio Code
    bug 
    opened by shibli-mueed 0
  • updated functionality of playlist_add_items()

    updated functionality of playlist_add_items()

    playlist_add_items() should not be able to accept pure IDs, since the type 'track' or 'episode' cannot be inferred. We are proposing a change where playlist_add_items is modified to only accept URIs and URLs

    bug spotipy3 
    opened by oliveraw 5
  • Spotipy doesnt doesnt respond but no error

    Spotipy doesnt doesnt respond but no error

    Hello,

    I have been using spotipy for the last year and never ran into any problems. Today, I realized that something is not working anymore and looked into it. I can initializing the sp.Spotify instance as usual without any problems, but if I then call a function (for example spotify.me() or spotify.devices(), it simply hangs and doesnt return anything.

    This is the code I used for the last months:

    with open("CONFIG.json", "r") as f:
        config = json.load(f)
    
    client_id = config["client_id"]
    client_secret = config["client_secret"]
    device_name = config["device_name"]
    redirect_uri = config["redirect_uri"]
    username = config["username"]
    scope = config["scope"]
    
    # authenticate account
    auth_manager = SpotifyOAuth(
        client_id=client_id,
        client_secret=client_secret,
        redirect_uri=redirect_uri,
        scope=scope,
        username=username
    )
    spotify = sp.Spotify(auth_manager=auth_manager)
    

    I checked my Spotify dashboard, and noticed, that noticed that the number of daily requests dropped to zero just when December started: image

    Do you have any idea what might cause the issue? I already tried to regenerate a new client secret, but it didnt work.

    I am using the version 2.21.0 on a raspberry pi (Raspbian version 10 [Buster])

    bug 
    opened by nickhir 0
  • Podcast Playlist retrieval not working

    Podcast Playlist retrieval not working

    Describe the bug Trying to call the "show_episodes" api in spotipy and getting back "returned 404 due to non existing id"

    Your code SHOW_ID = "00sL9tgDezr0PRSzd3C7H6" spotify = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials()) results = spotify.show_episodes(f'{SHOW_ID}')

    Expected behavior Should return shows as JSON

    Output /Users/mstephenson/opt/miniconda3/envs/RAMagGenPy/bin/python /Users/mstephenson/git/RGDSMag/venv/spotify.py HTTP Error for GET to https://api.spotify.com/v1/shows/00sL9tgDezr0PRSzd3C7H6/episodes/ with Params: {'limit': 50, 'offset': 0, 'market': None} returned 404 due to non existing id Traceback (most recent call last): File "/Users/mstephenson/opt/miniconda3/envs/RAMagGenPy/lib/python3.9/site-packages/spotipy/client.py", line 245, in _internal_call response.raise_for_status() File "/Users/mstephenson/opt/miniconda3/envs/RAMagGenPy/lib/python3.9/site-packages/requests/models.py", line 953, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.spotify.com/v1/shows/00sL9tgDezr0PRSzd3C7H6/episodes/?limit=50&offset=0

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/Users/mstephenson/git/RGDSMag/venv/spotify.py", line 9, in results = spotify.show_episodes(f'{SHOW_ID}') File "/Users/mstephenson/opt/miniconda3/envs/RAMagGenPy/lib/python3.9/site-packages/spotipy/client.py", line 512, in show_episodes return self._get( File "/Users/mstephenson/opt/miniconda3/envs/RAMagGenPy/lib/python3.9/site-packages/spotipy/client.py", line 297, in _get return self._internal_call("GET", url, payload, kwargs) File "/Users/mstephenson/opt/miniconda3/envs/RAMagGenPy/lib/python3.9/site-packages/spotipy/client.py", line 267, in _internal_call raise SpotifyException( spotipy.exceptions.SpotifyException: http status: 404, code:-1 - https://api.spotify.com/v1/shows/00sL9tgDezr0PRSzd3C7H6/episodes/?limit=50&offset=0: non existing id, reason: None

    Environment:

    • OS: Mac
    • Python version 3.9
    • spotipy version spotipy-2.21.0-py3-none-any.whl
    • your IDE (if using any) PyCharm

    Additional context I believe the scope is not being used. I can get the show ID using curl and the example here: https://developer.spotify.com/console/get-show-episodes/?id=00sL9tgDezr0PRSzd3C7H6&market=&limit=50&offset=0

    I can recreate the error in Curl if I use the Bearer ID from the spotipy client, so I believe there is an error with the Berer ID in that it needs to be in the correct scope (user-read-playback-position) - see https://developer.spotify.com/documentation/general/guides/authorization/scopes/

    bug 
    opened by deadl0ck 0
  • Remove mutable arguments and unused local variables. Style cleanup.

    Remove mutable arguments and unused local variables. Style cleanup.

    Fixes:

    • Remove mutable arguments
    • Remove unused arguments
    • Remove unnecessary parenthesis
    • Make whitespace for docstrings consistent
    • Mark static methods with the staticmethod decorator
    opened by howtri 0
Releases(2.22.0)
  • 2.22.0(Dec 10, 2022)

    Added

    • Integration tests via GHA (non-user endpoints)
    • Unit tests for new releases, passing limit parameter with minimum and maximum values of 1 and 50
    • Unit tests for categories, omitting country code to test global releases
    • Added CODE_OF_CONDUCT.md

    Fixed

    • Incorrect category_id input for test_category
    • Assertion value for test_categories_limit_low and test_categories_limit_high
    • Pin Github Actions Runner to Ubuntu 20 for Py27
    • Fixed potential error where found variable in test_artist_related_artists is undefined if for loop never evaluates to true
    • Fixed false positive test test_new_releases which looks up the wrong property of the JSON response object and always evaluates to true
    Source code(tar.gz)
    Source code(zip)
  • 2.21.0(Oct 29, 2022)

    Added

    • Added market parameter to album and albums to address #753
    • Added 'show_featured_artists.py' to 'examples'.
    • Expanded contribution and license sections of the documentation.
    • Added FlaskSessionCacheHandler, a cache handler that stores the token info in a flask session.
    • Added Python 3.10 in GitHub Actions

    Fixed

    • Updated the documentation to specify ISO-639-1 language codes.
    • Fix AttributeError for text attribute of the Response object
    • Require redis v3 if python2.7 (fixes readthedocs)
    Source code(tar.gz)
    Source code(zip)
  • 2.20.0(Jun 18, 2022)

    Added

    • Added RedisCacheHandler, a cache handler that stores the token info in Redis.
    • Changed URI handling in client.Spotify._get_id() to remove qureies if provided by error.
    • Added a new parameter to RedisCacheHandler to allow custom keys (instead of the default token_info key)
    • Simplify check for existing token in RedisCacheHandler

    Changed

    • Removed Python 3.5 and added Python 3.9 in Github Action
    Source code(tar.gz)
    Source code(zip)
  • 2.19.0(Aug 12, 2021)

    Added

    • Added MemoryCacheHandler, a cache handler that simply stores the token info in memory as an instance attribute of this class.
    • If a network request returns an error status code but the response body cannot be decoded into JSON, then fall back on decoding the body into a string.
    • Added DjangoSessionCacheHandler, a cache handler that stores the token in the session framework provided by Django. Web apps using spotipy with Django can directly use this for cache handling.

    Fixed

    • Fixed a bug in CacheFileHandler.__init__: The documentation says that the username will be retrieved from the environment, but it wasn't.
    • Fixed a bug in the initializers for the auth managers that produced a spurious warning message if you provide a cache handler and you set a value for the "SPOTIPY_CLIENT_USERNAME" environment variable.
    • Use generated MIT license and fix license type in pip show
    Source code(tar.gz)
    Source code(zip)
  • 2.18.0(Apr 13, 2021)

    Added

    • Enabled using both short and long IDs for playlist_change_details
    • Added a cache handler to SpotifyClientCredentials
    • Added the following endpoints
      • Spotify.current_user_saved_episodes
      • Spotify.current_user_saved_episodes_add
      • Spotify.current_user_saved_episodes_delete
      • Spotify.current_user_saved_episodes_contains
      • Spotify.available_markets

    Changed

    • Add support for a list of scopes rather than just a comma separated string of scopes

    Fixed

    • Fixed the bugs in SpotifyOAuth.refresh_access_token and SpotifyPKCE.refresh_access_token which raised the incorrect exception upon receiving an error response from the server. This addresses #645.
    • Fixed a bug in RequestHandler.do_GET in which the non-existent state attribute of SpotifyOauthError is accessed. This bug occurs when the user clicks "cancel" in the permissions dialog that opens in the browser.
    • Cleaned up the documentation for SpotifyClientCredentials.__init__, SpotifyOAuth.__init__, and SpotifyPKCE.__init__.
    Source code(tar.gz)
    Source code(zip)
  • 2.17.1(Feb 28, 2021)

  • 2.17.0(Feb 28, 2021)

    Changed

    • moved os.remove(session_cache_path()) inside try block to avoid TypeError on app.py example file
    • A warning will no longer be emitted when the cache file does not exist at the specified path
    • The docs for the auth parameter of Spotify.init use the term "access token" instead of "authorization token"
    • Changed docs for search to mention that you can provide multiple types to search for
    • The query parameters of requests are now logged
    • Deprecate specifing cache_path or username directly to SpotifyOAuth, SpotifyPKCE, and SpotifyImplicitGrant constructors, instead directing users to use the CacheFileHandler cache handler
    • Removed requirement for examples/app.py to specify port multiple times (only SPOTIPY_REDIRECT_URI needs to contain the port)

    Added

    • Added log messages for when the access and refresh tokens are retrieved and when they are refreshed
    • Support market optional parameter in track
    • Added CacheHandler abstraction to allow users to cache tokens in any way they see fit

    Fixed

    • Fixed Spotify.user_playlist_reorder_tracks calling Spotify.playlist_reorder_tracks with an incorrect parameter order
    • Fixed deprecated Urllib3 Retry(method_whitelist=...) in favor of Retry(allowed_methods=...)
    Source code(tar.gz)
    Source code(zip)
  • 2.16.1(Oct 24, 2020)

    Fixed

    • playlist_tracks example code no longer prints extra characters on final loop iteration
    • SpotifyException now thrown when a request fails & has no response (#571, #581)
    • Added scope, playlist-read-private, to examples that access user playlists using the spotipy api: current_user_playlists() (#591)
    • Enable retries for POST, DELETE, PUT (#577)

    Changed

    • both inline and starting import lists are sorted using isort module
    • changed Max Retries exception code from 599 to 429
    Source code(tar.gz)
    Source code(zip)
  • 2.16.0(Sep 16, 2020)

    Added

    • open_browser can be passed to the constructors of SpotifyOAuth and SpotifyPKCE to make it easier to authorize in browserless environments
    Source code(tar.gz)
    Source code(zip)
  • 2.15.0(Sep 8, 2020)

    Added

    • SpotifyPKCE.parse_auth_response_url, mirroring that method in SpotifyOAuth

    Changed

    • Specifying a cache_path or username is now optional

    Fixed

    • Using SpotifyPKCE.get_authorization_url will now generate a code challenge if needed
    Source code(tar.gz)
    Source code(zip)
  • 2.14.0(Aug 29, 2020)

    Added

    • (experimental) Support to search multiple/all markets at once.
    • Support to test whether the current user is following certain users or artists
    • Proper replacements for all deprecated playlist endpoints (See https://developer.spotify.com/community/news/2018/06/12/changes-to-playlist-uris/ and below)
    • Allow for OAuth 2.0 authorization by instructing the user to open the URL in a browser instead of opening the browser.
    • Reason for 403 error in SpotifyException
    • Support for the PKCE Auth Flow
    • Support to advertise different language to Spotify
    • Added 'collaborative' parameter to user_playlist_create method.
    • Enforce CHANGELOG update on PR
    • Adds additional_types parameter to retrieve currently playing podcast episode
    • Support to get info about a single category

    Deprecated

    • user_playlist_change_details in favor of playlist_change_details
    • user_playlist_unfollow in favor of current_user_unfollow_playlist
    • user_playlist_add_tracks in favor of playlist_add_items
    • user_playlist_replace_tracks in favor of playlist_replace_items
    • user_playlist_reorder_tracks in favor of playlist_reorder_items
    • user_playlist_remove_all_occurrences_of_tracks in favor of playlist_remove_all_occurrences_of_items
    • user_playlist_remove_specific_occurrences_of_tracks in favor of playlist_remove_specific_occurrences_of_items
    • user_playlist_follow_playlist in favor of current_user_follow_playlist
    • user_playlist_is_following in favor of playlist_is_following
    • playlist_tracks in favor of playlist_items

    Fixed

    • fixed issue where episode URIs were being converted to track URIs in playlist calls
    Source code(tar.gz)
    Source code(zip)
  • 2.13.0(Jun 25, 2020)

    Added

    • Added SpotifyImplicitGrant as an auth manager option. It provides user authentication without a client secret but sacrifices the ability to refresh the token without user input. (However, read the class docstring for security advisory.)
    • Added built-in verification of the state query parameter
    • Added two new attributes: error and error_description to SpotifyOauthError exception class to show authorization/authentication web api errors details.
    • Added SpotifyStateError subclass of SpotifyOauthError
    • Allow extending SpotifyClientCredentials and SpotifyOAuth
    • Added the market parameter to album_tracks
    Source code(tar.gz)
    Source code(zip)
  • 2.12.0(Apr 26, 2020)

  • 2.11.2(Apr 19, 2020)

    Changed

    • Updated the documentation to give more details on the authorization process and reflect 2020 Spotify Application jargon and practices.
    • The local webserver is only started for localhost redirect_uri which specify a port, i.e. it is started for http://localhost:8080 or http://127.0.0.1:8080, not for http://localhost.

    Fixed

    • Issue where using http://localhost as redirect_uri would cause the authorization process to hang.
    Source code(tar.gz)
    Source code(zip)
  • 2.11.1(Apr 11, 2020)

  • 2.11.0(Apr 11, 2020)

    Added

    • Support for shows/podcasts and episodes
    • Added CONTRIBUTING.md

    Changed

    • Client retry logic has changed as it now uses urllib3's Retry in conjunction with requests Session
    • The session is customizable as it allows for:
      • status_forcelist
      • retries
      • status_retries
      • backoff_factor
    • Spin up a local webserver to auto-fill authentication URL
    • Use session in SpotifyAuthBase
    • Logging used instead of print statements

    Fixed

    • Close session when Spotipy object is unloaded
    • Propagate refresh token error
    Source code(tar.gz)
    Source code(zip)
  • 2.10.0(Mar 18, 2020)

    Added

    • Support for add_to_queue
      • Parameters:
        • track uri, id, or url
        • device id. If None, then the active device is used.
    • Add CHANGELOG and LICENSE to released package
    Source code(tar.gz)
    Source code(zip)
  • 2.9.0(Feb 15, 2020)

    Added

    • Support position_ms optional parameter in start_playback
    • Add requests_timeout parameter to authentication methods
    • Make cache optional in get_access_token
    Source code(tar.gz)
    Source code(zip)
  • 2.8.0(Feb 12, 2020)

    Added

    • Support for playlist_cover_image
    • Support after and before parameter in current_user_recently_played
    • CI for unit tests
    • Automatic token refresh
    • auth_manager and oauth_manager optional parameters added to Spotify's init.
    • Optional username parameter to be passed to SpotifyOAuth, to infer a cache_path automatically
    • Optional as_dict parameter to control SpotifyOAuth's get_access_token output type. However, this is going to be deprecated in the future, and the method will always return a token string
    • Optional show_dialog parameter to be passed to SpotifyOAuth

    Changed

    • Both SpotifyClientCredentials and SpotifyOAuth inherit from a common SpotifyAuthBase which handles common parameters and logics.
    Source code(tar.gz)
    Source code(zip)
  • 2.7.1(Jan 20, 2020)

  • 2.7.0(Jan 20, 2020)

    Added

    • Support for playlist_tracks
    • Support for playlist_upload_cover_image

    Changed

    • user_playlist_tracks doesn't require a user anymore

    Deprecated

    • Deprecated user_playlist and user_playlist_tracks
    Source code(tar.gz)
    Source code(zip)
  • 2.6.3(Jan 16, 2020)

  • 2.6.2(Jan 16, 2020)

    Fixed

    • Fixed broken examples in README, examples and doc

    Changed

    • Allow session keepalive (improves performance x2)
    • Bump requests to 2.20.0
    Source code(tar.gz)
    Source code(zip)
  • 2.6.1(Jan 13, 2020)

    Fixed

    • Fixed inconsistent behaviour with some API methods when a full HTTP URL is passed.
    • Fixed invalid calls to logging warn method

    Removed

    • mock no longer needed for install. Only used in tox.
    Source code(tar.gz)
    Source code(zip)
  • 2.6.0(Jan 12, 2020)

    Added

    • Support for playlist to get a playlist without specifying a user
    • Support for current_user_saved_albums_delete
    • Support for current_user_saved_albums_contains
    • Support for user_unfollow_artists
    • Support for user_unfollow_users
    • Lint with flake8 using Github action

    Changed

    • Fix typos in doc
    • Start following SemVer properly
    Source code(tar.gz)
    Source code(zip)
An interactive App to play with Spotify data, both from the Spotify Web API and from CSV datasets.

An interactive App to play with Spotify data, both from the Spotify Web API and from CSV datasets.

Caio Lang 3 Jan 24, 2022
Spotify Top Lists - get the current top lists of a user from the Spotify API and display them in a Flask app

Spotify Top Lists This is a simple script that will get the current top lists of a user from the Spotify API and display them in a Flask app. Requirem

Yasin 0 Oct 16, 2022
A really easy way to display your spotify listening status on spotify.

Spotify playing README A really easy way to display your spotify listening status on READMEs and Websites too! Demo Here's the embed from the site. Cu

Sunrit Jana 21 Nov 6, 2022
Discord-Lite - A light weight discord client written in Python, for developers, by developers.

Discord-Lite - A light weight discord client written in Python, for developers, by developers.

Sachit 142 Jan 7, 2023
Light weight Scripts and Apps for checking availability of Covid Vaccines in India. Notifies when vaccine becomes avialable in your area.

vaccine-checker Light weight Scripts and Apps for checking availability of Covid Vaccines in India. Notifies when vaccine becomes avialable in your ar

Abishek V Ashok 8 Jun 16, 2021
A Simple, Easy to use and light-weight Pyrogram Userbot

Nexa Userbot A Simple, Easy to use and light-weight Pyrogram Userbot Deploy With Heroku With VPS (Local) Clone Nexa-Userbot repository git clone https

I'm Not A Bot #Left_TG 28 Nov 12, 2022
Spotify Web API client for Python 3

Welcome to the GitHub repository of Tekore! We provide a client for the Spotify Web API for Python, complete with all available endpoints and authenti

Felix Hildén 186 Dec 22, 2022
Change between dark/light mode depending on the ambient light intensity

svart Change between dark/light mode depending on the ambient light intensity Installation Install using pip $ python3 -m pip install --user svart Ins

Siddharth Dushantha 169 Nov 26, 2022
Create light scenes , voice control, ifttt, fuzzywuzzy speech correction and much more with Tuya light bulbs.

LightBox Features: Auto discover tuya lights Set and create moods (aka: light profiles) Change moods via IFTTT List moods via IFTTT FuzzyWuzzy, speech

Robert Nagtegaal 1 Dec 20, 2021
Web app for spotify playlist management with last.fm integration

Music Tools Set of utility tools for Spotify and Last.fm. Built on my other libraries for Spotify (spotframework), Last.fm (fmframework) and interfaci

andy 3 Dec 14, 2022
ETL python utilizando API do Spotify

Processo de ETL com Python e Airflow usando API do Spotify Sobre Projeto de ETL(Extract, Transform e Load) utilizando Python com API do Spotify e Airf

Leonardo 10 Mar 16, 2022
Module to use some statistics from Spotify API

statify Module to use some statistics from Spotify API To use it you have to import the functions into your own project. You have also to authenticate

Miguel Cózar 2 Jun 2, 2022
A light wrapper around FedEx's SOAP API.

Python FedEx SOAP API Module Author: Greg Taylor, Radek Wojcik Maintainer: Python FedEx Developers License: BSD Status: Stable What is it? A light wra

null 155 Dec 16, 2022
light wrapper for indeed.com api

Simple wrapper for indeed api. go to indeed.com - register for api publisher token example from indeed import IndeedApi token = 'your token' api =

null 16 Sep 21, 2022
JAKYM, Just Another Konsole YouTube-Music. A command line based Youtube music player written in Python with spotify and youtube playlist support

Just Another Konsole YouTube-Music Overview I wanted to create this application so that I could use the command line to play music easily. I often pla

Mayank Jha 73 Jan 1, 2023
A Python script to update Spotify Playlist data every 5 minutes.

Spotify Playlist Updater A Python script to update Spotify Playlist data every 5 minutes. Description An automatic playlist updater using Spotify API

null 6 Nov 24, 2022
Python script to backup/convert your Spotify playlists into the XSPF format.

Python script to backup/convert your Spotify playlists into the XSPF format.

Chris Ovenden 4 Jun 9, 2022
Python based Spotify account generator.

Spotify Account Generator Python based Spotify account generator. Installation Download the latest release, open command prompt in the folder, run pip

polo 5 Dec 27, 2022
Telegram Group Calls Streaming bot with some useful features, written in Python with Pyrogram and Py-Tgcalls. Supporting platforms like Youtube, Spotify, Resso, AppleMusic, Soundcloud and M3u8 Links.

Yukki Music Bot Yukki Music Bot is a Powerful Telegram Music+Video Bot written in Python using Pyrogram and Py-Tgcalls by which you can stream songs,

Team Yukki 996 Dec 28, 2022