I’m grabbing a list from a website using their API and saving it as variable “playlistNames”. In a later function when I call “playlistNames” to manipulate the data, is it making another API call? or is the data just stored locally in the “playlistNames” variable?
Sorry for such a silly question, I can’t seem to google this properly.
Advertisement
Answer
If you saved the API response to a variable, it won’t call the API every time you access that variable.
r = requests.get("https://google.com") print(r.text) # doesn't call again... print(r.status_code) # doesn't call again...