2

Just for simplicity, say I want to search Beyonce 1000 times

artist_name_list = []
for i in np.arange (0, 1000, 1):
  searchResults = sp.search("beyonce",1,0,"artist")
  artist = searchResults['artists']['items'][0]
  artist_name = artist['name']
  artist_name_list.append(artist_name)

When I run this, I get a 404 error at seemingly random points, which I can tell because the len(artist_name_list) differs every time I run it.

HTTP Error for GET to https://api.spotify.com/v1/search with Params: {'q': 'beyonce', 'limit': 1, 'offset': 0, 'type': 'artist', 'market': None} returned 404 due to None

Could someone help understand what's going on? It seemed to run earlier in the day.

Thank you!

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Feb 14 '22 at 20:53
  • Hey, I'm having the same problem as you, do you understand what this is due to ?? – Shadows1996 Mar 19 '22 at 16:58

1 Answers1

0

The only thing I can think of is that you're hitting some limitation on the API usage, maybe try inserting a pause between API requests, e.g. using time.sleep:

import time
time.sleep(5) # waits for 5 seconds
rob_med
  • 496
  • 3
  • 7