From b88df861c28190037b38294a6ce0521d82ca0a5f Mon Sep 17 00:00:00 2001 From: tmeissner Date: Wed, 27 Feb 2013 01:01:42 +0100 Subject: [PATCH] python script to get the vvo data and send it to the calling ajax js * we get a request from the ajax function in the javascript * we parse the queries of the request * we send a request with the parsed queries to the vvo server * we get the data from the vvo server * we send the data to the requesting ajax function --- scripts/abfahrtsmonitor.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 scripts/abfahrtsmonitor.py diff --git a/scripts/abfahrtsmonitor.py b/scripts/abfahrtsmonitor.py new file mode 100644 index 0000000..dd2a575 --- /dev/null +++ b/scripts/abfahrtsmonitor.py @@ -0,0 +1,35 @@ +#!/usr/bin/python +# -*- coding: iso-8859-1 -*- + +import cgi +import urllib +import urllib2 + + +# get cgi object +form = cgi.FieldStorage() + +ort = "" +hst = "" +vz = "" +vm = "" +timestamp = "" + +# check for queries +if (form.getvalue('ort')): + ort = form.getvalue('ort') +if (form.getvalue('hst')): + hst = form.getvalue('hst') +if (form.getvalue('vz')): + vz = form.getvalue('vz') +if (form.getvalue('vz')): + vm = 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 + +data = urllib2.urlopen(url).read() + +print("Content-type: text/html\n\n") +print(data)