[Twisted-web] How to use twisted.web2 http clients.
Cameron Dale
camrdale at gmail.com
Tue May 13 13:13:20 EDT 2008
On 5/13/08, Brian Carmalt <bca at contact.de> wrote:
> 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.
http://git.camrdale.org/?p=apt-p2p.git;a=blob;f=apt_p2p/HTTPDownloader.py
It's undergone some changes since then, including adding the fix for
ticket #3207. You're probably only interested in the parts of the Peer
class that implements the ClientManager interface and submitting
requests.
> 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.
Mine only does no content requests.
> 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.
Mine handles multiple GET and HEAD requests, not POST, and DELETE
should work but I haven't tried it.
Cameron
More information about the Twisted-web
mailing list