Created
August 22, 2018 22:16
-
-
Save ricardochaves/e23a12a905d587a2f622b0b83a7f7442 to your computer and use it in GitHub Desktop.
API flask
This file contains 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
from flask import Flask | |
from flask import jsonify | |
from time import sleep | |
from datetime import datetime | |
app = Flask(__name__) | |
@app.route("/") | |
def hello(): | |
sleep(3) | |
result = jsonify({"TIME": str(datetime.now())}) | |
result.headers["Cache-Control"] = "max-age=10" | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment