Here is an example of how to get the POST data :

# def do_POST(self):
# ctype, pdict = cgi.parse_header(self.headers.getheader('content-type'))
# length = int(self.headers.getheader('content-length'))
# if ctype == 'multipart/form-data':
# self.body = cgi.parse_multipart(self.rfile, pdict)
# elif ctype == 'application/x-www-form-urlencoded':
# qs = self.rfile.read(length)
# self.body = cgi.parse_qs(qs, keep_blank_values=1)
# else:
# self.body = {} # Unknown content-type
# # throw away additional data [see bug #427345]
# while select.select([self.rfile._sock], [], [], 0)[0]:
# if not self.rfile._sock.recv(1):
# break
# self.handle_data()


where handle_data() is the method where you will process the data received

The part related to bug #427345 is copied from CGIHTTPServer

For an example of use you can take a look at the CustomHTTPServer in Karrigell (http://karrigell.sourceforge.net)

A+,
Pierre
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to