Skip to content

Instantly share code, notes, and snippets.

@granttremblay
Last active March 13, 2019 01:52
Show Gist options
  • Save granttremblay/7fef5a1c00334a544d341b05f7e7e08b to your computer and use it in GitHub Desktop.
Save granttremblay/7fef5a1c00334a544d341b05f7e7e08b to your computer and use it in GitHub Desktop.
Download all Astro2020 Whitepaper PDFs
#!/usr/bin/env/python
import requests
from astropy.io import ascii
table = ascii.read('all_astro2020_whitepapers.csv')
numbers = table['Response ID']
people = table['Last Name:Principal Author']
urls = table['1:Upload File']
for number, person, url in zip(numbers, people, urls):
try:
pdf = requests.get(url, allow_redirects=True)
open('{}_{}.pdf'.format(number,person), 'wb').write(pdf.content)
print('Downloaded {}_{}.pdf'.format(number,person))
except:
print('ERROR downloading {}'.format(url))
print('Done')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment