Created
August 7, 2013 20:34
-
-
Save josephdunn/6178368 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 time | |
import random | |
import datetime | |
from flask import Flask | |
# app | |
app = Flask(__name__) | |
app.config.from_pyfile('config.py') | |
# views | |
@app.route('/') | |
def index(): | |
gotReqTime = datetime.datetime.now() | |
willSleep = random.randint(1, 10) | |
time.sleep(willSleep) | |
nowTime = datetime.datetime.now() | |
return 'Foo! I got a request at ' + str(gotReqTime) + ', then slept ' + str(willSleep) + ' seconds. It is now ' + str(nowTime) | |
if __name__ == '__main__': | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment