📜  带有数据上下文的烧瓶流 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:07.582000             🧑  作者: Mango

代码示例1
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()))