mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #384] Connect server-sided without webpage #227
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#227
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dicecko on GitHub (Jun 28, 2019).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/384
Hi I looked through a lot of documentation and issues, but I cannot find how I can just login through a python script and request my own data.
So I don't want to create a public app or something through the web. I just simply want to get my data back. Everything server-sided in a single py script without a frontend.
When I try this:
I get the error:
TypeError Traceback (most recent call last)
in ()
3 sp = spotipy.oauth2.SpotifyOAuth(client_id=client_id, client_secret=client_secret,scope=scope, redirect_uri='')
4 print(sp)
----> 5 token = sp.get_access_token()
6 print(token)
7 if token:
TypeError: get_access_token() missing 1 required positional argument: 'code'
I also just tried it directly with the requests module:
but then I get the error:
SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/me/tracks?offset=0&limit=20:
Insufficient client scope
But I have no idea where to add the scopes. I tried adding it in grant_type and as a seperate key-value pair in body_params, but that doesn't work.
@sibo7851 commented on GitHub (Sep 19, 2019):
I'm under the impression that this plugin is not actively developed, and I don't think it even works if you have a website setup (since I tried it using my sites working redirect URI and it did not give me python access).
@felix-hilden commented on GitHub (Dec 27, 2019):
It most certainly does work for a website setup! And maintenance is being continued. Have a look at #406.
For local use, you probably want to use
util.promp_for_user_tokento retrieve a token. That's very handy for single-user situations and small scripts. Have a look at the documentation for more information!And let me clarify, a browser window is absolutely needed for user authentication, whether that is spawned by a web app or just opened up locally. That's part of the OAuth2 specification. The application token can be retrieved without any browsers, but the user needs to manually grant access to your application.
@stephanebruckert commented on GitHub (Jan 11, 2020):
Answered by @felix-hilden, closing