Skip to content

Instantly share code, notes, and snippets.

@vibhatha
Created February 19, 2018 17:08
Show Gist options
  • Save vibhatha/e68cea5526cfe4196ddf278a1b2272d7 to your computer and use it in GitHub Desktop.
Save vibhatha/e68cea5526cfe4196ddf278a1b2272d7 to your computer and use it in GitHub Desktop.
Docker Flask REST API
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hey I'm using Docker!"
@app.route("/api/cpu")
def get_cpu:
# ADD CODE TO GET CPU INFO
# USE psutil LIBRARY
return "SHOW YOUR CPU INFO"
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True, port=80)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment