How to download pdf files in python?
<p>I need to download something like</p>

<pre><code>str = 'http://query.nytimes.com/mem/archive-free/pdf?res=9A00EEDE1431E13BBC4850DFBF66838A649FDE'
url = urllib2.urlopen(str)
file = open('test.pdf', 'w')
file.write(url.read())
file.close()
</code></pre>

<p>It just creates a wrong pdf.</p>

<p>how do I write that into file?</p>
