Last active
December 15, 2015 13:39
-
-
Save Kroisse/5269272 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import eventlet | |
| eventlet.monkey_patch() | |
| import time | |
| import flask | |
| def a(i): | |
| # shsh~~! | |
| return '<p>{0}</p>'.format(i) | |
| @flask.stream_with_context | |
| def process(): | |
| for i in xrange(100): | |
| yield a(i) | |
| time.sleep(1) | |
| app = flask.Flask(__name__) | |
| @app.route('/') | |
| def home(): | |
| return flask.Response(process()) | |
| if __name__ == '__main__': | |
| app.run() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| eventlet | |
| Flask |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment