You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
903 B
38 lines
903 B
|
|
import requests
|
|
from bs4 import BeautifulSoup
|
|
from datetime import date
|
|
|
|
# Variablen
|
|
errorMsg = ('HEUTE KEIN ESSEN')
|
|
menuMsg = ('Du hast bei Chemnitz.Kitchen bestellt! Heute gibt es:')
|
|
today = date.today()
|
|
today_url = today.strftime("%d.%m.%Y")
|
|
|
|
# Login URL
|
|
loginurl = ('https://chemnitz.kitchen/login/')
|
|
|
|
# Bestellübersicht
|
|
menu_url = f'https://chemnitz.kitchen/kunden/bestelluebersicht/?date_from={today_url}&date_to={today_url}'
|
|
|
|
#Logindaten
|
|
payload = {
|
|
'username': 'email',
|
|
'password': 'password'
|
|
}
|
|
|
|
# Einloggen und auf Bestellübersicht springen
|
|
with requests.session() as s:
|
|
s.post(loginurl, data=payload)
|
|
p = s.get(menu_url)
|
|
soup = BeautifulSoup(p.content, 'html.parser')
|
|
table = soup.find('table' ,attrs={'class':'food-order'})
|
|
rows = table.find_all('td')
|
|
description = rows[2].get_text()
|
|
|
|
|
|
|
|
textout = f' {menuMsg} {description}'
|
|
print(textout)
|
|
print(today)
|
|
|
|
|