API call 429 error every time (as soon as app was deployed)

I’m running an app that calls data from an API and returns some visualizations. The app was working great on my localhost, but as soon as I deployed it and fixed any other errors, the API calls stopped working. I try to get the data from the API as usual, but it just returns a 429 “too many requests” error code. I’ve tried running the exact same code on Jupyter Notebook and it runs fine, no clue why it’s doing this. Here’s my test function (I am running this in a dedicated test_app.py script with no other functions):

def test():
    sched_next = requests.get(st.secrets.url, 
                              headers={'referer': st.secrets.referer 'origin':st.secrets.origin,
                              'user-agent': 'Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US);'})
    sched = sched_next.text
    return sched

The error code:
W3e0426302c570d9800d4d82d3a8c4300301fc6ae9({“httpStatus”:“429”,“errorCode”:“10320”,“token”:“40fdf730f8ce4f16bd62d72743f7bb55”});

Why is this happening on the cloud version but not on Jupyter or my localhost version? How do I fix this?