Python request returns 404 while curl returns the pdf stream -
i new python , trying out sample requests , response. referring documentation. i'd pdf response , write local directory. tried curl this , returned stream using requests returned 404. page not require session , therefore called requests.get(url)
. missing this?
the webserver allowing curl's user agent, blocking 1 requests uses:
in [7]: import requests in [8]: url = 'http://www.analysis.im/uploads/seminar/pdf-sample.pdf' in [9]: requests.get(url) out[9]: <response [404]> in [10]: requests.get(url, headers={'user-agent': 'firefox'}) out[10]: <response [200]>
Comments
Post a Comment