Plan
Premium
Country
Japan
Device
Windows11 PC
Operating System
Windows 11
My Question or Issue
-I have tried to get my liked tracks list as json with coding python/spotipy according to api reference below.I have used Jupyter Lab as editor.
https://developer.spotify.com/documentation/web-api/reference/get-users-saved-tracks
On the way to do that, I knew it needs authorization code .
So, my code and the result returned is below.
I clicked authorization url, it was redirected to my spotify site once.
Then I pressed "Agree" . but next it has shown 404 not found error below.
Jupyter Server 404 : Not Found You are requesting a page that does not exist!
I have set redirect URI as follows.
http://localhost:8889/callback
redirect URIs are all the same in my code and settings in Spotify developer dashboard.
The reason why I am using 8889 is my port on my Jupyter lab (web server port) is
http://localhost:8889
Although I have not been sure if I should make redirect URI same as port my Jupter Lab Server. ..
Should it be same?
The more one reason, port # 8888 was already used in my PC by other web server.
I made it all the same regarding on 3 redirect URIs.
Could anyone please give me some advice
on what is causing this error and how to fix it?
I am waiting for your instructions if there is anything I should try to solve it.
https://developer.spotify.com/documentation/web-api/tutorials/code-flow
A part of My code
# Set up the SpotifyOAuth object
auth_manager = SpotifyOAuth(
client_id=client_id,
client_secret=client_secret,
redirect_uri=redirect_uri,
scope=scope
)
# Get the authorization URL and have the user authorize your app
auth_url = auth_manager.get_authorize_url()
print(f'Please visit this URL to authorize the application: {auth_url}')
# After the user authorizes your app, get the authorization code from the redirect URL
# and use it to get an access token
code = input('Please enter the authorization code: ')
auth_manager.get_access_token(code)
# Now you can use Spotipy to make authenticated API requests
sp = spotipy.Spotify(auth_manager=auth_manager)
results = sp.current_user_saved_tracks(limit=10, offset=5, market='JP')
print(results)
The result returned
Please visit this URL to authorize the application: https://accounts.spotify.com/authorize?client_id=xxxxxxxxxxxxxxxxxxx&response_type=code&redirect_uri...
Please enter the authorization code: