On Feb 3, 9:35 am, Chris Rebert <c...@rebertia.com> wrote:
> On Thu, Feb 3, 2011 at 12:15 AM, Markus <markus...@gmail.com> 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
>
> http://docs.python.org/library/basehttpserver.htmlhttp://docs.python.org/library/simplehttpserver.htmlhttp://docs.python.org/library/cgihttpserver.html
>
> > 2. Send GET or POST data (url encoded, or from form) - example
> > Name="Foo"
>
> http://docs.python.org/library/urllib.html#urllib.urlencode
>
> > 3. Analyze the GET/POST variable value on server and match to
> > different value
> >    example 'if Name = "Foo" then retval = "Bar" '
>
> http://docs.python.org/library/cgi.html
>
> > 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.
>
> You'll be reinventing quite a few wheels if you work at such a low
> level of abstraction. Have you considered using a web framework?
> Django (http://www.djangoproject.com/) is one of the popular ones,
> though there are a myriad of options
> (http://wiki.python.org/moin/WebFrameworks). I would recommend
> learning Python first and then a web framework, rather than trying to
> learn both in tandem.
>
> Cheers,
> Chris
> --http://blog.rebertia.com

Thank you for all that input, I will definitely check Django - it
looks very interesting.
I just found an example code that fits perfectly and is simple enough
for me to play with it.
http://stackoverflow.com/questions/336866/how-to-implement-a-minimal-server-for-ajax-in-python
And one older post handling the same case with HTTPS:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/a1e761a02a852821/2ff6f704b3a6749a?lnk=gst&q=server+parse+post#2ff6f704b3a6749a

:o)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to