> From: Tiago Katcipis <katci...@inf.ufsc.br> > > I am trying to make a small HTTP server on python just to handle some POST > and GET requests. I never worked with http before and dont know if i am > doing something completely stupid (probably yes). I read anything possible > already and i just cant find how i access the information sent on the POST > request, i need these because some parameters needed by the server must be > sent on the POST request, my client test does this: > > > f = urllib2.urlopen(url, urllib.urlencode('http://my_server_adress:port', > {'Teste' : 'teste', 'Teste2' : 't2', 'Teste3' : 't3'})) > f.close() > > The server runs ok and receives the POST request just fine, but im not > finding where the data that i have sent on the post request is being held. > Sorry if the question is extremely stupid, i really tried a lot of things > already and read a lot, maybe i just have let something pass when i was > reading or i am understanding something terribly wrong :-(.
Hello, I needed to do the same recently to test my scripts that do GET and POST to a web site. Found how to get at the posted data within CGIHTTPServer.py particularly the run_cgi method of the CGIHTTPRequestHandler class. At first I just ran an instance of the CGIHTTPServer and had a few CGI scripts until I read the code for the run_cgi method above. Now my test script runs an HTTP server in a daemon thread using my subclass of the CGIHTTPRequestHandler then the main thread then runs my GET and POST code. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor