[Tutor] Handling post request

Alan Gauld alan.gauld at btinternet.com
Wed Jan 28 12:03:34 CET 2009


"Tiago Katcipis" <katcipis at inf.ufsc.br> wrote

>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).

Not stupid so much as overly complicated.

The cgi module will do all the hard work for you including 
transparently
handling POST and GET requests

Read the web HOWTO document:

http://docs.python.org/howto/webservers.html

Then read the CGI module documentation which includes a very quick
introduction to CGI programming. If you are intending expanding the 
web
site to anything beyond trivial consider using a Framework such as
Django, Turbo Gears or Pylons.

Unless you are trying to do something very clever - which given your
level of knowledge I'd guess is not the case - then the standard
cgi module should do all you need!

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list