Hello all, I'm trying to write a http client which supports GET,POST,HEAD and DELETE using twisted.web2. I have a searched, for most of a morning and can find no documentation or examples, at least that is current. I did find something from dreid, but it dates from 2006 and the web2.client.HTTPClient he uses no longer exists in web2 version 0.2. Can anyone please point me in the right direction? Thanks, Brian
Hello good sir, On Feb 20, 2008, at 3:08 AM, Brian Carmalt wrote:
Hello all,
I'm trying to write a http client which supports GET,POST,HEAD and DELETE using twisted.web2.
A noble goal.
I have a searched, for most of a morning and can find no documentation or examples, at least that is current.
There has never existed any serious documentation or examples of using twisted.web2.client.
I did find something from dreid, but it dates from 2006 and the web2.client.HTTPClient he uses no longer exists in web2 version 0.2. The twisted.web2.client.HTTPClient you're referring to never existed outside of a branch. It was based heavily on zanshin and had several fatal flaws including not reusing any existing HTTP parsing code.
Can anyone please point me in the right direction?
You're looking for twisted.web2.clienth.http. However there is unfortunately no documentation and no examples and only a vague hypothesis about how to actually use it. I'd be glad to help you either here or on irc (freenode.net #twisted.web) Cleaning this up is something I do plan to do in the near future however it's possible I'll be hit by a car and die before I get the chance. I hope this was somewhat helpful. -David
On 2/20/08, David Reid <dreid@dreid.org> wrote:
On Feb 20, 2008, at 3:08 AM, Brian Carmalt wrote:
I have a searched, for most of a morning and can find no documentation or examples, at least that is current.
There has never existed any serious documentation or examples of using twisted.web2.client.
I'm using the web2 client, so you can look at my code if you're interested in seeing how it can work: http://git.camrdale.org/?p=apt-dht.git;a=blob_plain;f=apt_dht/HTTPDownloader... It's probably not a great example, but it does work. :) It's based on the dummy HTTPClientManager in the twisted code. After initializing it with the host and port, you use it by calling the get() or getRange() functions. All the other functions are for internal use. Cameron
Hello David, thanks for your answer and your offer to help. I've already got a server running with web2. It supports streaming reads and writes and digest authentication. I would like to have the same on the the client side. The streaming however is not files from disk, but on the fly data received from a client of my client. This means I need to open a connection, pump data into it as it arrives or read data from it as requested, and then close it when I am done. Is this possible with the twisted.web2.client.http? I think I need to wrap the incoming data stream in a producer which implements IProducer and pass the producer to a POST connection, which should act as a consumer and send the data on its way as it arrives. And Conversely for a GET connection. Does that sound OK, or am I shooting in the dark? Thanks, Brian PS. Thanks to Cameron for his Client code. Unfortunately it doesn't deal with the streaming problem.
participants (3)
-
Brian Carmalt
-
Cameron Dale
-
David Reid