【发布时间】:2015-06-11 17:23:53
【问题描述】:
我有一个网址:
myhost.com/largejsondata
在 python flask-restful 中,我想提供相同的 largejsondata。如何流式传输?我知道在 flask-restful 的 get 函数中我可以做到:
class LargeJSON(Resource):
def get(self, todo_id):
#openup a URL that contains a large jsonfile
#stream output as it appears from previous line to the end-users browser
return jsonfile
api.add_resource(LargeJSON, '/largefile')
但是我如何正确地将其放入响应中,以便在"requests.get" 处理输出时将输出“流式传输”到浏览器?
【问题讨论】:
标签: python flask flask-restful