mirror of
https://github.com/MrUnknownDE/linux-script.git
synced 2026-04-24 01:03:48 +02:00
beginn corona-stats script but my landkreis website is boring
This commit is contained in:
30
corona_stats/run.py
Normal file
30
corona_stats/run.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import sys
|
||||
import PyPDF2
|
||||
import pdfminer
|
||||
import logging
|
||||
import requests
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
import urllib
|
||||
import urllib.request
|
||||
from datetime import date, timedelta
|
||||
import re
|
||||
import wget
|
||||
|
||||
today = date.today()
|
||||
url = 'http://covid19.barnim.de/fileadmin/portal/corona/Lagebericht/2021/'
|
||||
url_notice = 'http://covid19.barnim.de/fileadmin/portal/corona/Lagebericht/2021/{0}_Lagebericht_Corona-Homepage.pdf'.format(today)
|
||||
r = requests.get(url, allow_redirects=True)
|
||||
pdf = open('{0}_Lagebericht_Corona-Homepage.pdf'.format(today), "r")
|
||||
|
||||
print('Download Link: {0}'.format(url_notice))
|
||||
|
||||
print('Downloading ...')
|
||||
if os.path.isfile('{0}_Lagebericht_Corona-Homepage.pdf'.format(today)):
|
||||
print("File exist on local drive")
|
||||
else:
|
||||
open('{0}_Lagebericht_Corona-Homepage.pdf'.format(today), 'wb').write(r.content)
|
||||
|
||||
print('opeing ...')
|
||||
print(pdf.read())
|
||||
Reference in New Issue
Block a user