parent
a640834a99
commit
6ba1595719
@ -1,54 +1,54 @@ |
||||
|
||||
import requests |
||||
import json |
||||
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") |
||||
today_url = ('30.11.22') |
||||
|
||||
# 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() |
||||
menu = rows[1].get_text() |
||||
|
||||
|
||||
#JSON |
||||
JsonDictionary = { |
||||
f'date': today_url, |
||||
f'menu': menu, |
||||
f'description': description } |
||||
dictionary_string = json.dumps(JsonDictionary, ensure_ascii=False,) |
||||
dataString = dictionary_string |
||||
|
||||
|
||||
|
||||
textout = f' {menuMsg} {description}' |
||||
|
||||
datei = open("ck.json", "w", encoding="utf-8") |
||||
datei.writelines(dictionary_string) |
||||
datei.close() |
||||
print(textout) |
||||
print(dictionary_string) |
||||
|
||||
import requests |
||||
import json |
||||
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") |
||||
#today_url = ('05.12.22') |
||||
|
||||
# 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 |
||||
login = { |
||||
'username': 'email', |
||||
'password': 'password' |
||||
} |
||||
|
||||
# Einloggen und auf Bestellübersicht springen |
||||
with requests.session() as s: |
||||
s.post(loginurl, data=login) |
||||
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() |
||||
menu = rows[1].get_text() |
||||
|
||||
|
||||
#JSON |
||||
JsonDictionary = { |
||||
f'date': today_url, |
||||
f'menu': menu, |
||||
f'description': description } |
||||
dictionary_string = json.dumps(JsonDictionary, ensure_ascii=False,) |
||||
dataString = dictionary_string |
||||
|
||||
|
||||
|
||||
textout = f' {menuMsg} {description}' |
||||
|
||||
datei = open("ck.json", "w", encoding="utf-8") |
||||
datei.writelines(dictionary_string) |
||||
datei.close() |
||||
print(textout) |
||||
print(dictionary_string) |
||||
|
||||
|
||||
|
||||
Loading…
Reference in new issue