title: Download a file using python from a webpage without opening the webpage
body: <p>I was looking for a way to write a script that will download a file from a specific website but without opening the website itself. I want everything to happen in the background.</p>
  
  <p>The website is morningstar and a specific link for the example is this one:
  <a href="https://financials.morningstar.com/ratios/r.html?t=MSFT" rel="nofollow noreferrer">https://financials.morningstar.com/ratios/r.html?t=MSFT</a>
  in this page, there is a "Button" (it is not really declared as a button but as a Hyperlink, the <code>&lt;a&gt;</code> tag in HTML)</p>
  
  <p>I added a photo in the bottom so you can see for yourself exactly the way they wrote the code.</p>
  
  <p>Anyway, I saw that when I clicked the button the href attribute actually calls a javascript function which then creates the links from which the file will be downloaded.</p>
  
  <p>I am looking for a way that I can write a script and give it the link I want, for example, the link above, and the script will download this specific CSV file from that page into a folder of my choice.</p>
  
  <p>I was looking at some selenium tutorials but I couldn't find much help for my specific problem.</p>
  
  <p><a href="https://i.stack.imgur.com/Lptfy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Lptfy.png" alt="enter image description here"></a></p>