[GH-ISSUE #101] analysis_url #48

Closed
opened 2026-02-27 23:20:34 +03:00 by kerem · 2 comments
Owner

Originally created by @Snippern on GitHub (Jun 14, 2016).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/101

Hi!

I'm suddenly no longer able to access analysis_url and very curious to find out if I'm the only one experiencing this problem. I'm getting error status 401 with the message "No token provided". I'm using the prompt_for_user_token function to authenticate.

Thank you in advance!
-Snippern

Originally created by @Snippern on GitHub (Jun 14, 2016). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/101 Hi! I'm suddenly no longer able to access analysis_url and very curious to find out if I'm the only one experiencing this problem. I'm getting error status 401 with the message "No token provided". I'm using the prompt_for_user_token function to authenticate. Thank you in advance! -Snippern
kerem closed this issue 2026-02-27 23:20:35 +03:00
Author
Owner

@plamere commented on GitHub (Jun 14, 2016):

There was a change to the spotify API - you are now required to include
your auth token when you get the analysis url. This can be done easily with
the _get method like so:

from spotipy.oauth2 import SpotifyClientCredentials
import json
import spotipy
import time
import sys

client_credentials_manager = SpotifyClientCredentials()
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)
sp.trace=False

if len(sys.argv) > 1:
artist_name = ' '.join(sys.argv[1:])
results = sp.search(q=artist_name, limit=50)
tids = []
for i, t in enumerate(results['tracks']['items']):
print(' ', i, t['name'])
tids.append(t['uri'])

start = time.time()
features = sp.audio_features(tids)
delta = time.time() - start
for feature in features:
    print(json.dumps(feature, indent=4))
    print()
  •    analysis = sp._get(feature['analysis_url'])*
    print(json.dumps(analysis, indent=4))
    print()
    

On Tue, Jun 14, 2016 at 12:53 PM, Snippern notifications@github.com wrote:

Hi!

I'm suddenly no longer able to access analysis_url and very curious to
find out if I'm the only one experiencing this problem. I'm getting error
status 401 with the message "No token provided". I'm using the
prompt_for_user_token function to authenticate.

Thank you in advance!
-Snippern


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/plamere/spotipy/issues/101, or mute the thread
https://github.com/notifications/unsubscribe/AAFvGa_WJq9RlPXPflY0PcxD8NdKOFN2ks5qLtx3gaJpZM4I1iKf
.

<!-- gh-comment-id:225977317 --> @plamere commented on GitHub (Jun 14, 2016): There was a change to the spotify API - you are now required to include your auth token when you get the analysis url. This can be done easily with the _get method like so: from spotipy.oauth2 import SpotifyClientCredentials import json import spotipy import time import sys client_credentials_manager = SpotifyClientCredentials() sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager) sp.trace=False if len(sys.argv) > 1: artist_name = ' '.join(sys.argv[1:]) results = sp.search(q=artist_name, limit=50) tids = [] for i, t in enumerate(results['tracks']['items']): print(' ', i, t['name']) tids.append(t['uri']) ``` start = time.time() features = sp.audio_features(tids) delta = time.time() - start for feature in features: print(json.dumps(feature, indent=4)) print() ``` - analysis = sp._get(feature['analysis_url'])* print(json.dumps(analysis, indent=4)) print() On Tue, Jun 14, 2016 at 12:53 PM, Snippern notifications@github.com wrote: > Hi! > > I'm suddenly no longer able to access analysis_url and very curious to > find out if I'm the only one experiencing this problem. I'm getting error > status 401 with the message "No token provided". I'm using the > prompt_for_user_token function to authenticate. > > Thank you in advance! > -Snippern > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > https://github.com/plamere/spotipy/issues/101, or mute the thread > https://github.com/notifications/unsubscribe/AAFvGa_WJq9RlPXPflY0PcxD8NdKOFN2ks5qLtx3gaJpZM4I1iKf > .
Author
Owner

@Snippern commented on GitHub (Jun 14, 2016):

Perfect! Thank you so much!

<!-- gh-comment-id:225990514 --> @Snippern commented on GitHub (Jun 14, 2016): Perfect! Thank you so much!
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#48
No description provided.