1import urllib.request
2pdf_path = ""
3def download_file(download_url, filename):
4 response = urllib.request.urlopen(download_url)
5 file = open(filename + ".pdf", 'wb')
6 file.write(response.read())
7 file.close()
8
9download_file(pdf_path, "Test")
1import requests
2url='https://pdfs.semanticscholar.org/c029/baf196f33050ceea9ecbf90f054fd5654277.pdf'
3r = requests.get(url, stream=True)
4
5with open('myfile.pdf', 'wb') as f:
6f.write(r.content)