diff --git a/importer.py b/importer.py index f1b1738a84f256803e9b59168a64feea5dd4fe1a..117bb1a320e5eaf387635b6ccea1a8cf5c727b4a 100644 --- a/importer.py +++ b/importer.py @@ -32,7 +32,10 @@ def import_from(source=None, id=None): import urllib.request # if u have to port this to anything new, god be with you. for i in import_campus: - remote_html = urllib.request.urlopen(i['url']).read() + try: + remote_html = urllib.request.urlopen(i['url']).read() + except: + flash("Ungültige URL: '"+i['url']"'") tablexpath = "//td[text()='Termine und Ort']/following::table[1]" basetable = html.fromstring(remote_html).xpath(tablexpath)[0] parsebase = html.tostring(basetable);