[Twisted-Python] HTTP PUT a GET's streaming response with treq

Nagy, Attila bra at fsn.hu
Thu May 4 09:30:50 MDT 2017


On 05/04/2017 04:48 PM, Phil Mayers wrote:
> On 04/05/17 14:32, Nagy, Attila wrote:
>
>> Are there any problems with this approach?
>
> You're poking at a private member of the .original IResponse there, 
> and moreover the transport object which seems risky.
I would like to use the simplest (and correct of course) solution. 
Juggling with buffering/data by hand seems even more risky to me.
Your implementation seems to do things which twisted should do, which 
(also) doesn't seem to be right. :)
It would be nice if this could be solved in an elegant way.

>
> The single treq.collect call to consumer.write will also not 
> necessarily respect the consumer-issued flow control (even if touching 
> the _transport was valid, you don't know you won't get buffered data 
> after you've been asked to stop)
It seems to do what I want to do. :)

BTW (without reading it), I've tried your solution (thank you very much 
for it!).
 From a 1073741824 bytes source file, it transferred a 1056490639 
destination file.
Another run made a 1044534695 bytes destination file.
Well, each run yields a different size.





More information about the Twisted-Python mailing list