How to create streamlit long running

I have developed a Streamlit application,then I use streamlit run,it will allow me to open the url to visit.But if after some times no active connection from this url,I visit again,it canโ€™t not access this url again.How can I solve this issue?

Hi @Jerry_yuan

You can use the status_code parameter when running requests.get on a URL. If it returns 200 then it means the request was successful and based on this you can use conditionals to make a decision on what to do next.

Hope this helps!

import requests 

response = requests.get('') 

if response.status_code == 200:
  print('Oh no!')

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.