Skip to content

Instantly share code, notes, and snippets.

@bthaman
Created November 19, 2018 15:33
Show Gist options
  • Save bthaman/b9c037a5f4804c38bbf3eedfc54dd5e0 to your computer and use it in GitHub Desktop.
Save bthaman/b9c037a5f4804c38bbf3eedfc54dd5e0 to your computer and use it in GitHub Desktop.
Python function to download a pdf from the web
import requests
def download_file(url, out_file_name):
try:
pdf_url = url
r = requests.get(pdf_url)
with open(out_file_name, 'wb') as f:
f.write(r.content)
except Exception as e:
print('download_file error: ' + str(e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment