From 37028ba5451b052753e7364336208e780b3fe426 Mon Sep 17 00:00:00 2001 From: tmeissner Date: Wed, 27 Feb 2013 13:34:50 +0100 Subject: [PATCH] encode queries before use them with the url in the urlopen() method * creating an sequence of two-element tuples with the queries gotten from the ajax calling instance * use that sequence of tuples with the urlencode() method to create the encoded string of queries --- scripts/abfahrtsmonitor.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/abfahrtsmonitor.py b/scripts/abfahrtsmonitor.py index dd2a575..849faa2 100644 --- a/scripts/abfahrtsmonitor.py +++ b/scripts/abfahrtsmonitor.py @@ -11,8 +11,8 @@ form = cgi.FieldStorage() ort = "" hst = "" -vz = "" -vm = "" +vz = "" +vm = "" timestamp = "" # check for queries @@ -27,8 +27,15 @@ if (form.getvalue('vz')): if (form.getvalue('timestamp')): timestamp = form.getvalue('timestamp') -url = "http://widgets.vvo-online.de/abfahrtsmonitor/Abfahrten.do?ort="+ort+"&hst="+hst+"&vz="+vz+"&vm="+vm+"×tamp="+timestamp +queries = { + "ort": ort, + "hst": hst, + "vz": vz, + "vm": vm, + "timestamp": timestamp +} +url = "http://widgets.vvo-online.de/abfahrtsmonitor/Abfahrten.do?" + urllib.urlencode(queries) data = urllib2.urlopen(url).read() print("Content-type: text/html\n\n")