Python, how to get the http header
<p>I was making a script to "automate my life" :) but came across an issue that I'm not able to solve.</p>

<p>This python script goes scrapes a page and gets the links of the "products" I need, the problem is that once I've the link to the page of the product to download the pdf of this "product" you have to press a button, and that's the issue because there is no href in the button:</p>

<pre><code>&lt;Form name="F1" method="POST" action="onSubmit="if($$('btn_download').disabled)return false;$$('btn_download').value='Invia File...';$$('btn_download').disabled=true;return true;"&gt;
</code></pre>

<p>Looking at the http header when the button is pressed I saw that to download the file it uses a link like this: </p>

<pre><code>https://example.com:443/d/vmlz3ovktv2fvxijixczjdagbdnaeamniexu4zypx3tlesibbhuievcy/product.pdf
</code></pre>

<p>The value "vmlz3ovktv2fvxijixczjdagbdnaeamniexu4zypx3tlesibbhuievcy" changes every day, any suggestion on how to overcome this issue?</p>

<p>Is it possible in python to get the http header and parse to get the value?
Or to press a button and then handle the download?</p>

<p>Many thanks!</p>

<p>It doesn't solve the problem of "getting the header", but I would suggest using <a href="http://www.seleniumhq.org/" rel="nofollow">Selenium</a>. It's a web browser automation tool and you can set your script to click on the button.</p>

<p>Here's the Selenium reference for Python: <a href="http://selenium-python.readthedocs.io/" rel="nofollow">link</a></p>

python http download header automation