ucalyptus / Spotify-Recommendation-Engine

Music Recommender System
https://ucalyptus.github.io/Spotify-Recommendation-Engine/
MIT License
229 stars 116 forks source link

I don't know is this a bug or error in the (working_notebook.ipynb) #109

Open shreesha345 opened 2 years ago

shreesha345 commented 2 years ago

when I run the last line this one 👇 playlist_recs =sp.user_playlist_create(username,name='PCA + tf-idf + DT - Recommended Songs for Playlist - {}'.format(sourcePlaylist['name']))

I get the HTTP error in that saying this:-

--------------------------------------------------------------------
HTTPError                          Traceback (most recent call last)
d:\spotify-recommender-systems\packs\lib\site-packages\spotipy\client.py in _internal_call(self, method, url, payload, params)
    244 
--> 245             response.raise_for_status()
    246             results = response.json()

d:\spotify-recommender-systems\packs\lib\site-packages\requests\models.py in raise_for_status(self)
    952         if http_error_msg:
--> 953             raise HTTPError(http_error_msg, response=self)
    954 

HTTPError: 403 Client Error: Forbidden for url: https://api.spotify.com/v1/users/Shreeshaaithal/playlists

During handling of the above exception, another exception occurred:

SpotifyException                   Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_2708/1131807193.py in <module>
----> 1 playlist_recs =sp.user_playlist_create(username,name='PCA + tf-idf + DT - Recommended Songs for Playlist - {}'.format(sourcePlaylist['name']))

d:\spotify-recommender-systems\packs\lib\site-packages\spotipy\client.py in user_playlist_create(self, user, name, public, collaborative, description)
    782         }
    783 
--> 784         return self._post("users/%s/playlists" % (user,), payload=data)
    785 
    786     def user_playlist_change_details(

d:\spotify-recommender-systems\packs\lib\site-packages\spotipy\client.py in _post(self, url, args, payload, **kwargs)
    300         if args:
    301             kwargs.update(args)
--> 302         return self._internal_call("POST", url, payload, kwargs)
    303 
    304     def _delete(self, url, args=None, payload=None, **kwargs):

d:\spotify-recommender-systems\packs\lib\site-packages\spotipy\client.py in _internal_call(self, method, url, payload, params)
    270                 "%s:\n %s" % (response.url, msg),
    271                 reason=reason,
--> 272                 headers=response.headers,
    273             )
    274         except requests.exceptions.RetryError as retry_error:

SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/users/Shreeshaaithal/playlists:
 You cannot create a playlist for another user., reason: None

please help 🙏 all the API token is mine but still this is giving me an error please help me.

github-actions[bot] commented 2 years ago

Note : Issue is still open to others. Only a merged PR is evaluated as a contribution, till then it is open to all.