I have created a streamlit app that has a download button to download a csv file. I want to automatically download the content using "GET" or "POST" requests. is there anyway to do that?
Here is my app URL: https://maalaei97-test2.hf.space/?__theme=light
I tried to use urllib2.Request("GET", URL) but I receive None. I should mention that since I use the python script inside a software which only supports Iron Python, I do not have access to libraries like Beautifulsoap and requests. But I have access to urllib2 and webbrowser libraries.
CodePudding user response:
I've checked your website, it uses the JavaScript on that button to open a new window and download your CSV. The actual URL in your case is:
https://maalaei97-test2.hf.space/media/c721b14394345aab14989004e9ce8a3bae6fbb02a8e8d6a41a4f5401.csv?title=app · Streamlit
I think you can download this with urllib
and GET
request. If you want to click on that link with python, you need to run JavaScript code.