Announcements

Help Wizard

Step 1

NEXT STEP

Projects with API

Projects with API

Plan Premium

Country France

Device MSI Katana 17 B12VFK

Operating System Windows 11

My Question or Issue :


Hello community,

I am currently working on a Python automation script using the spotipy library to manage my music library (around 350 artists). I have two distinct projects, but I am facing several roadblocks, primarily authorization errors.
1. My two projects

Project A (Monthly Radar): A script that runs every month to check for the latest releases (albums/singles) from my 350 artists. The goal is to extract all these new tracks and add them into a single, unified monthly playlist.

Project B (Initialization): A "one-shot" script that searches for the official "This Is [Artist Name]" playlist for each artist, creates a private playlist with their name on my personal account, and copies all the tracks into it.

 

2. Configuration

I am using the Authorization Code flow (SpotifyOAuth) with the playlist-modify-private user-read-private scopes. My application is currently in Development mode.

3. Errors encountered

- 403 Forbidden Error (Main blocker): Authentication in the browser succeeds (the consent window correctly asks for playlist creation/modification rights). I have double-checked and verified that my Spotify account email is properly added to the "User Management" section of the Developer Dashboard. However, as soon as the script tries to create a playlist or add tracks to it, the server systematically returns a 403 Forbidden error.

- Search errors (NoneType / Empty returns): During searches (sp.search), the API sometimes returns empty or unexpected structures for some very well-known artists, which crashes the script if I don't heavily bulletproof the code.

429 Error (Rate Limit): By looping through my 350 artists, I quickly hit the request limit (resulting in a temporary ban of several hours).

 

I would gladly welcome any suggestions regarding code structure or logic to bypass these restrictions and properly handle these two use cases.

 

I tried to find solutions via ChatGPT, Gemini Pro, and Claude, without success. The code is attached.


Thanks in advance for your help!

Reply
0 Replies

Suggested posts

Let's introduce ourselves!

Hey there you, ย  Yeah, you!ย 😁 ย  Welcome - we're glad you joined the Spotify Community! ย  While you here, let's have a fun game and getโ€ฆ

ModeratorStaff / Moderator/ 4 years ago  in Social & Random