title: Download pdf using urllib?
body: <p>I am trying to download a pdf file from a website using urllib. This is what i got so far:</p>
  
  <pre><code>import urllib
  
  def download_file(download_url):
      web_file = urllib.urlopen(download_url)
      local_file = open('some_file.pdf', 'w')
      local_file.write(web_file.read())
      web_file.close()
      local_file.close()
  
  if __name__ == 'main':
      download_file('http://www.example.com/some_file.pdf')
  </code></pre>
  
  <p>When i run this code, all I get is an empty pdf file. What am I doing wrong?</p>