Skip to content
Snippets Groups Projects
Commit d1f36cb0 authored by Andreas Valder's avatar Andreas Valder
Browse files

no longer crashing with invalid campus urls. closes #148

parent ab68dcd2
No related branches found
No related tags found
No related merge requests found
......@@ -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:
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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment