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 :-(. O already have take a look at: http://docs.python.org/library/simplehttpserver.html#module-SimpleHTTPServer http://docs.python.org/library/basehttpserver.html#BaseHTTPServer.BaseHTTPRequestHandler.handle_one_request http://effbot.org/librarybook/simplehttpserver.htm http://personalpages.tds.net/~kent37/kk/00010.html my server code is: def adcionar_tratador_server(endereco_servidor, tratador): BaseHTTPServer.HTTPServer(endereco_servidor, tratador).serve_forever() class TratadorRequisicaoHTTPIDLocutor(BaseHTTPServer.BaseHTTPRequestHandler): def do_HEAD(self): print self.command print self.path print self.headers print self.headers.getplist() print self.raw_requestline print urlparse.urlparse(self.path) return 'ok' def do_GET(self): print self.command print self.path print self.headers print self.headers.getplist() print self.raw_requestline print urlparse.urlparse(self.path) return 'ok' def do_POST(self): print self.command print self.path print self.headers print self.headers.getplist() print self.raw_requestline print urlparse.urlparse(self.path) return 'ok' adcionar_tratador_server(('', 8000) , TratadorRequisicaoHTTPIDLocutor) -- "it might be a profitable thing to learn Java, but it has no intellectual value whatsoever" Alexander Stepanov
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor