title: How to download file from a page using python
body: <p>I am having troubles downloading txt file from this page: <a href="https://www.ceps.cz/en/all-data#RegulationEnergy" rel="nofollow noreferrer">https://www.ceps.cz/en/all-data#RegulationEnergy</a> (when you scroll down and see Download: txt, xls and xml). </p>
  
  <p>My goal is to create scraper that will go to the linked page, clicks on the txt link for example and saves a downloaded file.</p>
  
  <p>Main problems that I am not sure how to solve:</p>
  
  <ul>
  <li><p>The file doesn't have a real link that I can call and download it, but the link is created with JS based on filters and file type. </p></li>
  <li><p>When I use <code>requests</code> library for python and call the link with all headers it just redirects me to <a href="https://www.ceps.cz/en/all-data" rel="nofollow noreferrer">https://www.ceps.cz/en/all-data</a> .</p></li>
  </ul>
  
  <p>Approaches tried:</p>
  
  <ul>
  <li><p>Using scraper such as ParseHub to download link didn't work as intended. But this scraper was the closest to what I've wanted to get. </p></li>
  <li><p>Used <code>requests</code> library to connect to the link using headers that HXR request uses for downloading the file but it just redirects me to <a href="https://www.ceps.cz/en/all-data" rel="nofollow noreferrer">https://www.ceps.cz/en/all-data</a> .</p></li>
  </ul>
  
  <p>If you could propose some solution for this task, thank you in advance. :-)</p>