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

Phil Mayers p.mayers at imperial.ac.uk
Thu May 4 07:04:13 MDT 2017


On 04/05/17 13:04, Nagy, Attila wrote:
> Hi,
> 
> I would like to copy a file between two HTTP servers in the most 
> efficient manner, which probably means a streaming down/upload (GET/PUT) 
> with the producer/consumer scheme.
> 
> Can this be done easily, could somebody write a simple example?

I guess it'll look something like this:

https://gist.github.com/philmayers/692d04c15a71d3905e075b30f0543f23

Only lightly tested, but seems to work. There's a lot of debugging print 
statements in the above code which can obviously be discarded or turned 
into logging statements in production use.




More information about the Twisted-Python mailing list