Get QUERY_STRING using python
Struggling to see why this isn't working:
import MySQLdb
import cgi, cgitb
import os
from wsgiref.simple_server import make_server
from cgi import parse_qs, escape
def index(req):
d = parse_qs(os.environ['QUERY_STRING'])
dtbox = d.get('dt', [''])[0]
tmbox = d.get('tm', [''])[0]
The script returns a KeyError: QUERY_STRING
I can see the URL which is:
http://myserver/currentcost.py?dt=2013-09-10&tm=00
I'm simply lost!
No comments:
Post a Comment