Sorry for the really bad title this is hard to explain but im making a python script that can play songs in spotify and i imported 3 variables from another file called secrets.py and only two of the variables from secrets are working
here's the code from main.py:
import requests
from secrets import spotify_user_id, spotify_token, damn_id
class SaveSongs:
def __init__(self):
self.user_id = spotify_user_id
self.spotify_token = spotify_token
self.damn_weekly_id = damn_id
def find_songs(self):
#loop through playlist tracks
query = "https://api.spotify.com/v1/playlists/{}/tracks" .format(
damn_id)
response = requests.get(query,
headers={"Content-Type": "application/json",
"Authorization": "Bearer {}".format(spotify_token)})
response.json = response.json()
print(response)
a = SaveSongs()
a.find_songs()
Here's the code from secrets
Code:
spotify_user_id = "..."
spotify_token = "..."
damn_id = "5V9DHomv3ymanLUnPCRdD4"
I put periods in the token and userid because I can't show that information
And also here's the error I get when executing the script
Traceback (most recent call last):
File "c:/Users/Documents/Python spotify/main.py", line 3, in <module>
from secrets import spotify_user_id, spotify_token, damn_id
ImportError: cannot import name 'spotify_user_id' from 'secrets' (c:\Users\Documents\Python spotify\secrets.py)