-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
50 lines (32 loc) · 1023 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import requests
from bs4 import BeautifulSoup
from datetime import date
import PySimpleGUI as sg
version = "v1.0.1"
def process():
URL = "https://covid19ilfov.ro/"
page = requests.get(URL)
soup = BeautifulSoup(page.content, "html.parser")
results = soup.find_all("section", class_="corona-count-section home-4 bg-corona padding-tb pt-0")
for result in results:
global x
x = result.find("tr", id="row_glina").text
#print(x)
today = date.today()
dat = today.strftime("%d.%m.%Y")
with open(dat + ".txt", "w+") as handler:
handler.write(x.strip())
global y
y = handler.readline(6)
handler.close()
#os.startfile(dat + ".txt")
process()
def GUI():
layout = [[sg.Text(f"{x}")]]
window = sg.Window(f'Covid Tracker {version}', layout, resizable=False, size=(290, 250))
while True:
event, values = window.read()
if event in (sg.WIN_CLOSED, 'Cancel'):
break
window.close()
GUI()