This is how I did it:
- My configuration: Pycharm (Editor) and Windows (OS).
- Close Pycharm first.
- I called the CLIENT_ID as SPOTIPY_CLIENT_ID
- I called the CLIENT_SECRET as SPOTIPY_CLIENT_SECRET
- I called the REDIRECT_URI as SPOTIPY_REDIRECT_URI
- Now, set the ENVIRONMENT VARIABLES as follows:
ON WINDOWS
control panel >> system and security >> system >> advanced system settings >> tab "advanced" >>
environment variables >> SYSTEM VARIABLES >> clicked "New" >> now type your SPOTIPY_CLIENT_ID and its value* >>
new >> now type your SPOTIPY_CLIENT_SECRET and its value* >> new >>
now type your SPOTIPY_REDIRECT_URI and its value** >> CLICK OK
---
* Spotify gave this to you
** You gave this to Spotify
ON PYCHARM
if Pycharm is open, close it and open it again
---
file >> settings >> search for "environment variables" >> click "edit environment variables" >> tick the box
"include system environment variables" >> CLICK OK
Done.
When you run main.py, it should take your credentials and log in just fine into Spotify to do its work.
Here are some links that could point you to a direction: