[Web-SIG] Request/Response features

Simon Willison cs1spw at bath.ac.uk
Wed Oct 22 23:42:51 EDT 2003


Ian Bicking wrote:
> I've very interested into getting some sort of sane request/response 
> object into the Python standard library, to form the basis of an 
> informal standard on how those objects should look (even if wrappers or 
> adaptation are required for most frameworks).  Technically I suppose 
> cgi.FieldStorage is a request object, but it's not a very good one, and 
> it's very incomplete outside of CGI (e.g., output goes to sys.stdout, 
> headers come from os.environ), and unusable in a threaded environment.

I think that's an absolutely fantastic idea. Request / Response objects 
are the one thing that almost all Python web frameworks deal with in 
some way, and a standardised interface for them in the standard library 
could do a lot for improving cross-framework compatibility.

> A useful starting point might be to summarize the features that various 
> request/response implementations already have.  Thoughts?  Wild 
> enthusiasm from anyone to take on the project?  If no one else is 
> interested I could probably take this on.

I have plenty of enthusiasm, but it's coupled with youthful ignorance 
(I've been using Python for web development for just over a month). That 
said, I'm happy to contribute serious time and effort to this.

In a previous post I outlined the things that I liked about PHP's web 
interface features, which while not exactly modelled on a 
request/response object do cover the same ground. I think the most 
valuable thing PHP's treatment of this brings to the table is the 
concept of GET, POST and COOKIE dictionaries for looking up data sent by 
the client (also the REQUEST dictionary which combines the three).

One other thing I've been thinking about recently is that HTTP requests 
and HTTP responses both consist of a set of headers and a body, in a 
very similar way to MIME email messages which are already well catered 
for by the standard library. I think any standard for request/response 
objects should aim to closely match the way MIME style messages are 
handled by other parts of the standard library (in particular the email 
module).

Cheers,

Simon Willison
http://simon.incutio.com/




More information about the Web-SIG mailing list