parse GET/POST data on simple http server

Corey Richardson kb1pkl at aim.com
Thu Feb 3 09:26:22 CET 2011


On 02/03/2011 03:15 AM, Markus wrote:
> Hi,
> 
> As a beginner in python, I am looking for example code that would help
> me understand how to
> code following idea:
> 1. Start minimal http server
> 2. Send GET or POST data (url encoded, or from form) - example
> Name="Foo"
> 3. Analyze the GET/POST variable value on server and match to
> different value
>     example 'if Name = "Foo" then retval = "Bar" '
> 4. serve the content of retval back to user as plain html
> 
> If some code snipped that does implement all or part of the algorithm
> is known to you, please point me to it. I would be thankful for any
> push to the right direction.
> 
> Thank you!

If you really can't use a 'real' webserver like Apache, I found [1]. Not
sure how to use it, never had the need to. The documentation will show
you the way, however. Using that and the cgi module, your requirements
should be fulfilled.



More information about the Python-list mailing list