title: Download dynamic file to local using python
body: <p>Me - Python beginner level</p>
  <p>Created the document based on user requirements in virtual machine. Once report generated by using <strong>Phantomjs</strong> &amp; storing it in tmp folder. <strong>By that time browser loads again</strong>.</p>
  <p>This generation of file will take atleast 20 secs.
  Once it generates
  I want to download that file from virtual machine to local by showing browser default dialog for file download.</p>
  <p>Can you share any process by using
  <strong>Subprocess</strong>, or if any</p>
  <pre><code>if(os.path.exists(url)):
    log(LOG_ERR, &quot;path exists&quot;)
    r = requests.get(url, allow_redirects=True)
    open('download.pdf', 'wb').write(r.content)
  </code></pre>