[Twisted-web] How to use twisted.web2 http clients.

Brian Carmalt bca at contact.de
Tue May 13 06:26:36 EDT 2008


Hello all, 

I have set up a twisted.web2 http server and would like to use the web2
client to connect to it. I have been using the httplib in Python, but it
is tedious to use and has a significant(for my project) bug in it(no
100-continue support). 

I have asked a similar question a couple of months ago, Cameron Dale
responded with an example of how he uses the http client in web2, but
the the link he supplied is no longer available and I cannot seem to
find a local copy. I looked at his example when he posted the link, but
it did not seem like it was relevant to the cases I have. If I am wrong,
could you post the example agian Cameron? Thanks.   
 
Here is what I need to implement: 

Streaming POST:
1) create connection
2) set up connection
3) check for a 100-continue and authenticate if necessary. 
3) stream data over the connection, in small chunks with unknown content length or from files.
4) check the response.
5) close connection/or reuse it if I can.  

Multiple One-shot POST, GET, HEAD and DELETES
1) create connection
2) set up connection
3) authenticate if necessary. 
3) send multiple POST/GET/HEAD/DELETE commands and retrieve the   
   responses.
4) close connection when done. 

For the Streaming POSTs I need to support HTTP 1.1, chunked encoding,
persistent connections and 100-continue. This means web2, as far as I
can tell. The same for the one-shot requests, if I want to use
persistent connections, I need web2. 

Is this correct? Or can I get the same functionality in web?

If I have to use web2, could somebody help me in the right direction? 
If this is possible in web, then a hint in that direction and how i
could do it would also be appriciated.

Thank you, 

Brian






More information about the Twisted-web mailing list