[Tutor] HTTP GET Request
paul brian
paul1brian at gmail.com
Tue Sep 27 18:04:46 CEST 2005
> Basicall, what I need is a stand alone CGI. Instead of the program passing
> the data off to a CGI, I want it to parse and handle the request directly.
instead of which program ?
Http requests are served by a web server (ie Apache), which depending
on the type of request passes the request to wherever.
As such any HTTP request *must* be handled first by a web server, and
cgi scripts traditionally lived in cgi-bin directory on the server so
a URL would look like http://www.example.com/cgi-bin/myscript.py
I think you have 3 options
1. use the cgi module in python to create scripts like the one above.
They will not be fast but it gives you a lowlevel access to the request
However cgi was out of date about 8 years ago - it has some
serious limitations mostly on speed/capacity.
2. use a system like mod_python. This is better than cgi for lots of reasons,
mostly to do with speed. Here you also have access to the request
objects, but there is a bit of a learning curve.
3. Zope - higher level than even mod_python and still more of a learning curve
(there is a multitude of python based cgi repalcements, Django,
webware and others spring to mind. But there is no clear "winner"
amoungst the community)
I would recommend that you look at taking a weekend to install apache,
and play with both the cgi module and mod_python. mod_python is
pretty good and fairly well documented, as well as being pretty low
level.
I think there is a lot to do here - perhaps if you tell us exactly
what you need we can point you at a solution. Some web hosters provide
mod_python or zope hosting and that might be a way to get up and
running faster.
On 9/27/05, Jerl Simpson <jerl.simpso at gmail.com> wrote:
> Hello,
>
> I have been looking through some of the HTTP projects and haven't quite
> found what I'm looking for.
> Basicall, what I need is a stand alone CGI. Instead of the program passing
> the data off to a CGI, I want it to parse and handle the request directly.
>
> The part I'm having trouble with is actually getting the request and parsing
> it.
>
> Let's say I have a URI that looks like:
> ?var1=val1&var2=val2&...varn=valn
>
> I'd like to find a way to get these into some datastructure so I can use
> them to generate my output.
>
> It seems like a simple thing, but as I'm new to python, I don't know where
> to start.
>
> Thank you for any help you can give.
>
>
> Jerl
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
>
--
--------------------------
Paul Brian
m. 07875 074 534
t. 0208 352 1741
More information about the Tutor
mailing list