To download a pdf from a given web url using python, a solution is to use the module urllib. Lets try to download the file available from the following url
http://math.univ-toulouse.fr/~besse/Wikistat/pdf/st-intro.pdf
using urlretrieve:
>>> import urllib
>>> urllib.urlretrieve('http://math.univ-toulouse.fr/~besse/Wikistat/pdf/st-intro.pdf', "st-intro.pdf")
Note: it is also possible to directly change the name of the file (we can called it new_file.pdf for instance):
>>> urllib.urlretrieve('http://math.univ-toulouse.fr/~besse/Wikistat/pdf/st-intro.pdf', "new_file.pdf")
See also
Links | Tags |
---|---|
How to download a file (pdf, text,...) from a url using python ? | Python; urlretrieve |
How to list and download all files from a url directory using python ? | Python; urlretrieve |