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

Nagy, Attila bra at fsn.hu
Fri May 5 03:41:41 MDT 2017


On 05/05/2017 10:26 AM, Phil Mayers wrote:
> On 04/05/17 16:30, Nagy, Attila wrote:
>
>> I would like to use the simplest (and correct of course) solution.
>> Juggling with buffering/data by hand seems even more risky to me.
>
> The problem with the approach you've outlined is that it treats the 
> transport (a private member) in ways that I suspect are invalid. In 
> particular there's no handling of the length of the object or chunked 
> encodings - I suspect what you're doing will only work on simple HTTP 
> requests with no connection reuse.
What possible side effects do you see here? What problems could it cause?
So far I've tried to copy a lot of files in parallel, arbitrarily drop 
connections. Everything seems OK.
The file is either transferred in its entirety or (in case of dropped 
connections) not.
>
>> 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.
>
> On that I completely agree. It could be that there's some simple idiom 
> or built-in code for this that I'm unaware of.
I couldn't find a complete example for this task, so it would be nice if 
somebody more experienced could share the secret of doing this right and 
nice. :)

Thanks,




More information about the Twisted-Python mailing list