Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

flask stream with data/context

from flask import stream_with_context, request, Response

@app.route('/stream')
def streamed_response():
    def generate():
        yield 'Hello '
        yield request.args['name']
        yield '!'
    return Response(stream_with_context(generate()))
Source by flask.palletsprojects.com #
 
PREVIOUS NEXT
Tagged: #flask #stream
ADD COMMENT
Topic
Name
3+7 =