Download com Python


import requests
import pathlib
url = 'https://readthedocs.org/projects/python-guide/downloads/pdf/latest/'
req = requests.get(url, allow_redirects=True, stream=True)
myfile = pathlib.Path('~/documents/pdf/python-guide.pdf').resolve()
myfile.parent.mkdir(parents=True, exist_ok=True)
myfile.write_bytes(myfile.content)

Comentários