Home  >  Q&A  >  body text

How to automatically download a web page file with a download button without using BeautifulSoup?

<p>I have created a Streamlit application which has a download button for downloading CSV files. I want to automatically download content using "GET" or "POST" requests. Is there any way to do this? </p> <p>This is my application URL: https://maalaei97-test2.hf.space/?__theme=light</p> <p>I tried using urllib2.Request("GET", URL) but I received None. I should mention that since I'm using a python script in a software that only supports Iron Python, I don't have access to libraries like Beautifulsoap and requests. But I have access to urllib2 and webbrowser libraries. </p>
P粉762730205P粉762730205416 days ago433

reply all(1)I'll reply

  • P粉546179835

    P粉5461798352023-08-31 11:03:25

    I've checked your site and it uses JavaScript to open a new window on that button and download your CSV file. In your case the actual URL is:

    https://maalaei97-test2.hf.space/media/c721b14394345aab14989004e9ce8a3bae6fbb02a8e8d6a41a4f5401.csv?title=app%20%C2%B7%20Streamlit

    I think you can download it using urllib and GET requests. If you want to click the link using Python, you need to run the JavaScript code.

    reply
    0
  • Cancelreply