Skip to content

Instantly share code, notes, and snippets.

@ricardochaves
Created August 22, 2018 22:16
Show Gist options
  • Save ricardochaves/e23a12a905d587a2f622b0b83a7f7442 to your computer and use it in GitHub Desktop.
Save ricardochaves/e23a12a905d587a2f622b0b83a7f7442 to your computer and use it in GitHub Desktop.
API flask
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