-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
55 lines (45 loc) · 1.59 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
import requests
import pandas as pd
from datetime import datetime as dt
#Global Variables and Dictionaries
day_of_the_week = {
"Monday":"ponedeljek",
"Tuesday":"torek",
"Wednesday":"sreda",
"Thursday":"četrtek",
"Friday":"petek",
"Saturday":"sobota",
"Sunday":"nedelja",
}
menu = dict()
# Functions
def marjetica():
r = requests.get("https://marjetice.si/")
mainBody = r.text
mainBody = mainBody[mainBody.find("<body"):mainBody.find("</body")]
temporarySearchalg = mainBody[mainBody.find('blogPost'):mainBody.find("</div>",mainBody.find('blogPost'))]
datum = dt.now().strftime("%d.%m.%Y")
temporarySearchalg = temporarySearchalg[(temporarySearchalg.find(datum)+ len( datum+"<strong>")+1):temporarySearchalg.find("</p>",temporarySearchalg.find(datum))]
table_with_food = temporarySearchalg.split("<br />")[1:]
for i in range(len(table_with_food)):
table_with_food[i] = table_with_food[i].split(",")
return table_with_food
def femza():
table_with_food = pd.read_html('https://www.fe.uni-lj.si/o_fakulteti/restavracija/tedenski_meni/')
datum = dt.now().strftime("%w")
if int(datum) > 0:
datum = int(datum) - 1
else:
datum = 6
# print(datum)
# print(table_with_food[datum])
return table_with_food[datum]
def main():
print("initiating program, please wait a second while we fetch the data")
print(marjetica())
print(femza())
with open("menu.txt","w") as file:
file.write("Today's menu options are:")
file.write("STARVATION")
if __name__ == "__main__":
main()