I have a url:
myhost.com/largejsondata
In python flask-restful, I want to serve that same largejsondata. How do I stream it? I know within the get function for flask-restful I could do:
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')
but how do I properly get it into a response such that it would "stream" output to the browser as output is processed by the "requests.get"
?
With flask you can stream data like this
from http://flask.pocoo.org/docs/0.10/patterns/streaming/
here you have some doc for the Response object http://flask.pocoo.org/docs/0.10/api/#response-objects