I am trying to fetch the status of a task from an API and want to show the current status automatically whenever it changes. So I would like to poll the API every 10secs without re-running the application.
I currently have a refresh button that checks the status, but the whole page loads whilst it carries out its query and you then can’t use the rest of the app in the 3 sec period, so re-querying this button on repeat doesn’t work for a user.
Button at end of the script, so it re-runs when this is queried.
if st.sidebar.button(‘check status’):
fetched = request.get(url, headers=headers)
st.write(fetched)