Skip to content

Instantly share code, notes, and snippets.

@simcard0000
Created April 22, 2020 21:37
Show Gist options
  • Save simcard0000/ae37c54c65418a00b4dcfcf4eb3f7c49 to your computer and use it in GitHub Desktop.
Save simcard0000/ae37c54c65418a00b4dcfcf4eb3f7c49 to your computer and use it in GitHub Desktop.
🐍 Quick script to download Covid-19 data every morning
import requests
import os
import shutil
import datetime
while 1:
#check what time it is
curr_date = str(datetime.datetime.today())
curr_hour = curr_date[11:13]
curr_min = curr_date[14:16]
curr_sec = curr_date[17:19]
if curr_hour == '09' and curr_min == '00' and curr_sec == '00':
#file type: xlsx
url = 'https://www.ecdc.europa.eu/sites/default/files/documents/COVID-19-geographic-disbtribution-worldwide.xlsx'
req = requests.get(url, allow_redirects=True)
open('cases.xlsx', 'wb').write(req.content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment