Skip to content

Instantly share code, notes, and snippets.

@keleshev
Created March 26, 2014 11:39
Show Gist options
  • Save keleshev/9781384 to your computer and use it in GitHub Desktop.
Save keleshev/9781384 to your computer and use it in GitHub Desktop.
from time import sleep
from flask import Flask, Response, request
app = Flask('hello')
@app.route('/')
def hello():
response = Response('hello %s' % request.args['hello'])
@response.call_on_close
def on_close():
for i in range(10):
sleep(1)
print i
return response
if __name__ == '__main__':
app.run(debug=True, port=5001)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment