I found a script on this site for running a simple server via the command line with python.
I added some print
lines in because I\'d like to print out the G
You can use cgi
module instead of urlparse
. cgi
implements POST params parsing out of the box. Using well-tested libraries seems better.
import cgi
def do_POST(self):
form = cgi.FieldStorage(
fp=self.rfile,
headers=self.headers,
environ={"REQUEST_METHOD": "POST"}
)
for item in form.list:
print "%s=%s" % (item.name, item.value)