parent
d489c36966
commit
02598acf10
@ -1,37 +1,37 @@ |
|||||||
|
|
||||||
import requests |
import requests |
||||||
from bs4 import BeautifulSoup |
from bs4 import BeautifulSoup |
||||||
from datetime import date |
from datetime import date |
||||||
|
|
||||||
# Variablen |
# Variablen |
||||||
errorMsg = ('HEUTE KEIN ESSEN') |
errorMsg = ('HEUTE KEIN ESSEN') |
||||||
menuMsg = ('Du hast bei Chemnitz.Kitchen bestellt! Heute gibt es:') |
menuMsg = ('Du hast bei Chemnitz.Kitchen bestellt! Heute gibt es:') |
||||||
today = date.today() |
today = date.today() |
||||||
today_url = today.strftime("%d-%m-%Y") |
today_url = today.strftime("%d-%m-%Y") |
||||||
|
|
||||||
# Login URL |
# Login URL |
||||||
loginurl = ('https://chemnitz.kitchen/login/') |
loginurl = ('https://chemnitz.kitchen/login/') |
||||||
|
|
||||||
# Bestellübersicht |
# Bestellübersicht |
||||||
menu_url = f'https://chemnitz.kitchen/kunden/bestelluebersicht/?date_from={today_url}&date_to={today_url}' |
menu_url = f'https://chemnitz.kitchen/kunden/bestelluebersicht/?date_from={today_url}&date_to={today_url}' |
||||||
|
|
||||||
#Logindaten |
#Logindaten |
||||||
payload = { |
payload = { |
||||||
'username': 'maik@matthes.me', |
'username': 'maik@matthes.me', |
||||||
'password': 'Zxvrbhen' |
'password': 'password' |
||||||
} |
} |
||||||
|
|
||||||
# Einloggen und auf Bestellübersicht springen |
# Einloggen und auf Bestellübersicht springen |
||||||
with requests.session() as s: |
with requests.session() as s: |
||||||
s.post(loginurl, data=payload) |
s.post(loginurl, data=payload) |
||||||
p = s.get(menu_url) |
p = s.get(menu_url) |
||||||
soup = BeautifulSoup(p.content, 'html.parser') |
soup = BeautifulSoup(p.content, 'html.parser') |
||||||
table = soup.find('table' ,attrs={'class':'food-order'}) |
table = soup.find('table' ,attrs={'class':'food-order'}) |
||||||
rows = table.find_all('td') |
rows = table.find_all('td') |
||||||
description = rows[2].get_text() |
description = rows[2].get_text() |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
textout = f' {menuMsg} {description}' |
textout = f' {menuMsg} {description}' |
||||||
print(textout) |
print(textout) |
||||||
|
|
||||||
|
|||||||
Loading…
Reference in new issue