-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
60 lines (48 loc) · 1.48 KB
/
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
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python3
"""
Emile Villette - October 2020
Automatic daily emaildata updates on the COVID-19 situation in Belgium
"""
import json
import os
import time
from Downloader import download_stats
from HTML_email_sender import send_HTML_email
from recap_generator import generate_recap
from generateGraphData import generate_graph_data
def main_function(test=True):
download_stats(yesterday=True)
path = download_stats() + "/"
# generate_graph_data()
files = os.listdir("User_data/Users")
for file in files:
with open("User_data/Users/" + file, "r") as user:
data = json.load(user)
recap = generate_recap(
"AA_RawDataProcessed.json",
path,
data["preferences"],
"AA_DAILY_TOTAL.json",
data["yesterday_missing"],
data["uuid"],
data["language"],
test_mode=False,
)
send_HTML_email(data["language"], data["email"], recap, "[email protected]", test_mode=test)
print(
"""
---------------------------------------------------------
"""
)
time.sleep(0.5)
if __name__ == "__main__":
while True:
is_test = input("Test mode (True or False)? >").lower()
if is_test == "true":
is_test = True
break
elif is_test == "false":
is_test = False
break
print("Invalid entry, try again")
main_function(test=is_test)