diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2017-10-26 12:37:52 +0200 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2017-10-26 12:37:52 +0200 |
commit | ff5121b7512f4677ddca1e922e4c66ca6b546694 (patch) | |
tree | bfc0086f27a07620addd95ebd3c03037283d874b /mensa | |
parent | e556881560d47d1ac79034da99253f1c9c84c92b (diff) | |
download | mensa-ff5121b7512f4677ddca1e922e4c66ca6b546694.tar.gz mensa-ff5121b7512f4677ddca1e922e4c66ca6b546694.tar.bz2 mensa-ff5121b7512f4677ddca1e922e4c66ca6b546694.zip |
Fixed error handling
Diffstat (limited to 'mensa')
-rw-r--r-- | mensa/backends/satyam.py | 3 | ||||
-rwxr-xr-x | mensa/logic.py | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/mensa/backends/satyam.py b/mensa/backends/satyam.py index 7ac53a0..e01b546 100644 --- a/mensa/backends/satyam.py +++ b/mensa/backends/satyam.py @@ -21,6 +21,7 @@ class Satyam(IPlugin): response = urllib.request.urlopen(req) the_page = response.read() document = html5lib.parse(the_page, treebuilder="lxml") + sys.stderr = s groupsel = CSSSelector('.news-latest-item-content') k = etree.tostring(groupsel(document)[0]) name = re.sub(r'<.+?>', ' ', str(k)) @@ -29,7 +30,7 @@ class Satyam(IPlugin): name = " ".join(name.split()) name = name.replace("5,95 €", "") - sys.stderr = s + return [Food("Mittagstisch Express", "5,95 €", "Mittagstisch", 2, name[3:-1])] diff --git a/mensa/logic.py b/mensa/logic.py index d2851d5..f14b89c 100755 --- a/mensa/logic.py +++ b/mensa/logic.py @@ -35,6 +35,8 @@ def get_food(restlist=False, options={}) : print(i.human_name + ": No menu found. This could be due to a holiday or due to an error in the script.") except urllib.error.HTTPError as e : print(i.human_name + ": Fetching menu failed: %s" % str(e)) + except : + print(i.human_name + ": Unknown error") return foodl def render(to_render, rendlist=False, options={}) : |