[GH-ISSUE #273] Spotipy: User_create_playlist - Method Not Allowed for url #150

Closed
opened 2026-02-27 23:21:05 +03:00 by kerem · 3 comments
Owner

Originally created by @jfaul on GitHub (Apr 8, 2018).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/273

I'm trying to figure out why the user_create_playlist method is not allowed for my url.

Here is part of my code showing how I'm authenticating my app and code I'm using to run the method:

username = 'my-username'
token = util.prompt_for_user_token(username = username,
                                    scope = 'playlist-modify-public'
                                    client_id='my-spotify-client-id',
                                    client_secret='my-spotify-client-secret-id',
                                    redirect_uri='https://developer.spotify.com/')
spotifyObject = spotipy.Spotify(auth=token)    
playlist_name = "Test Playlist"
playlist_description = "This is a test playlist."
playlists = spotifyObject.user_playlist_create(username, playlist_name, playlist_description)
pprint.pprint(playlists)

Do you know why I am getting the following error message?

(Traceback (most recent call last):
File "C:\Users....\spotipy\client.py", line 121, in _internal_call
r.raise_for_status()
File "C:\Users....requests\models.py", line 935, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 405 Client Error: Method Not Allowed for url: https://api.spotify.com/v1/users/'username'/playlists

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users....\SpotifyTest.py", line 108, in
main()
File "C:\Users....\SpotifyTest.py", line 53, in main
playlists = spotifyObject.user_playlist_create(username, playlist_name, playlist_description)
File "C:\Users....\spotipy\client.py", line 415, in user_playlist_create
return self._post("users/%s/playlists" % (user,), payload=data)
File "C:\Users.....\spotipy\client.py", line 180, in _post
return self._internal_call('POST', url, payload, kwargs)
File "C:\Users....\spotipy\client.py", line 129, in _internal_call
-1, '%s:\n %s' % (r.url, 'error'), headers=r.headers)
spotipy.client.SpotifyException: http status: 405, code:-1 - https://api.spotify.com/v1/users/'username'/playlists:
error)

Originally created by @jfaul on GitHub (Apr 8, 2018). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/273 I'm trying to figure out why the user_create_playlist method is not allowed for my url. Here is part of my code showing how I'm authenticating my app and code I'm using to run the method: username = 'my-username' token = util.prompt_for_user_token(username = username, scope = 'playlist-modify-public' client_id='my-spotify-client-id', client_secret='my-spotify-client-secret-id', redirect_uri='https://developer.spotify.com/') spotifyObject = spotipy.Spotify(auth=token) playlist_name = "Test Playlist" playlist_description = "This is a test playlist." playlists = spotifyObject.user_playlist_create(username, playlist_name, playlist_description) pprint.pprint(playlists) Do you know why I am getting the following error message? (Traceback (most recent call last): File "C:\Users\....\spotipy\client.py", line 121, in _internal_call r.raise_for_status() File "C:\Users\....requests\models.py", line 935, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 405 Client Error: Method Not Allowed for url: https://api.spotify.com/v1/users/'username'/playlists During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\....\SpotifyTest.py", line 108, in <module> main() File "C:\Users\....\SpotifyTest.py", line 53, in main playlists = spotifyObject.user_playlist_create(username, playlist_name, playlist_description) File "C:\Users\....\spotipy\client.py", line 415, in user_playlist_create return self._post("users/%s/playlists" % (user,), payload=data) File "C:\Users\.....\spotipy\client.py", line 180, in _post return self._internal_call('POST', url, payload, kwargs) File "C:\Users\....\spotipy\client.py", line 129, in _internal_call -1, '%s:\n %s' % (r.url, 'error'), headers=r.headers) spotipy.client.SpotifyException: http status: 405, code:-1 - https://api.spotify.com/v1/users/'username'/playlists: error)
kerem closed this issue 2026-02-27 23:21:05 +03:00
Author
Owner

@ritiek commented on GitHub (Apr 9, 2018):

Check out https://github.com/plamere/spotipy/issues/242#issuecomment-354764118.

<!-- gh-comment-id:379648912 --> @ritiek commented on GitHub (Apr 9, 2018): Check out https://github.com/plamere/spotipy/issues/242#issuecomment-354764118.
Author
Owner

@mmasque commented on GitHub (Oct 1, 2019):

Getting the same exact issue. Any updates?

<!-- gh-comment-id:537072282 --> @mmasque commented on GitHub (Oct 1, 2019): Getting the same exact issue. Any updates?
Author
Owner

@stephanebruckert commented on GitHub (Jan 11, 2020):

This should be fixed with version 2.5.0, just do:

pip install spotipy --upgrade
<!-- gh-comment-id:573340168 --> @stephanebruckert commented on GitHub (Jan 11, 2020): This should be fixed with version 2.5.0, just do: pip install spotipy --upgrade
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#150
No description provided.