given the simplest HTTP server, how do I get post variables in a BaseHTTPRequestHandler?
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
class Handler(BaseHTTPRequestHandler):
def do_POST(self):
# post variables?!
server = HTTPServer(('', 4444), Handler)
server.serve_forever()
# test with:
# curl -d "param1=value1¶m2=value2" http://localhost:4444
I would simply like to able to get the values of param1 and param2. Thanks!
I tried to edit the post and got rejected, so there's my version of this code that should work on Python 2.7 and 3.2: