In my Flask project I use ftputil library. In one of the application sections I use content streaming as described in Flask documentation:
@app.route('/section')
def section():
def generate():
ftp.upload(source, target, "b", callback)
yield 'completed'
return Response(generate())
Function generate
from the example makes file uploading to FTP server as described in ftputil documentation.
Callback function [callback(chunk)
] used in upload
method executes for each uploaded file chunk.
Is there any posibility to output len(chunk)
from the callback to the stream? Any dirty hacks are also very much welcome.
Thanks for any help!