Suggestion: "Completing" HTTP support in Python. (was Re: SSL and POST with httplib or urllib

Robb Shecter shecter at darmstadt.gmd.de
Thu Jun 15 11:50:14 EDT 2000


Hi,

I was really suprised to see that HTTP client support in Python isn't
really quite complete.  What I mean is, I was hoping to find an
interface at a higher level, like this:

Wishful example #1
--------------
h = HTTP('my.host.name', '/loginscript', 8080)
h.add_parameter('username', 'Robb')
(code, msg, headers) = h.post()

Wishful example #2
--------------
h = HTTP('my.host.name', 8080)
h.add_header('X-local-hack', 'true')
(code, msg, headers) = h.get()

Notes: A black-box interface - no understanding of HTTP spec's details
(like how to quote parameters) is necessary.  A simplified and less
error-prone interface - no "endheaders" type call necessary. The
difference between GET and POST amounts to changing one word.

...without this kind of interface, I bet there's a lot of duplication
going on.  And, cookie support would of course also be great.  If
anything, as an option that could be enabled, where cookie information
would be managed by an HTTP object from invocation to invocation.

I've found bits and pieces of things that can do some of this (like
urlpost.py that I found on Parnassus, and cookie support from that
Python browser.)

I need this kind of interface because I'm working on an HTTP-based
distributed object project, and I've run screaming from Java...  I had
to implement vast parts of the HTTP library there, but there were
unending bugs that made the job a nightmare.

So - is anybody else interested in seeing a client interface that
allows the whole HTTP spec to be used, without getting down into the
mucky details?  I can see that I'll be working on this for sure.  I'd
be much more motivated if I knew that my work wasn't going to just sit
around.  I think this kind of interface should be in the core library.

Interested in comments,
- Robb




More information about the Python-list mailing list