diff --git a/bot.py b/bot.py index 2bd95c5..2f3ab27 100755 --- a/bot.py +++ b/bot.py @@ -4,8 +4,9 @@ Code for schneiderbot """ import os import datetime -import urllib.request -import json +# import urllib.request +# import json +import requests import logging import random @@ -60,8 +61,11 @@ async def mensa(which="zentral"): # Es ist zu spät am Tag, zeig das essen für morgen an today += 1 - with urllib.request.urlopen("https://mensa.schneider-hosting.de/static/%s.%d.json" % (MENSA_URL[which], today)) as url: - data = json.loads(url.read().decode()) + # with urllib.request.urlopen("https://mensa.schneider-hosting.de/static/%s.%d.json" % (MENSA_URL[which], today)) as url: + # print(url.read().decode()) + # data = json.loads(url.read().decode()) + + data = requests.get("https://mensa.schneider-hosting.de/static/%s.%d.json" % (MENSA_URL[which], today)).json() await BOT.say("Das Essen für %s in der %s" % (data["date"], MENSA_NAME[which]))