diff --git a/exercises/python-helloworld/app.py b/exercises/python-helloworld/app.py index 6a1abe02a..9e4b8f4d2 100644 --- a/exercises/python-helloworld/app.py +++ b/exercises/python-helloworld/app.py @@ -1,6 +1,33 @@ +from email.mime import application +import json +import mimetypes +from urllib import response from flask import Flask app = Flask(__name__) + + +@app.route('/status') +def status(): + response = app.response_class( + response=json.dumps({"result":"OK - healthy"}), #json.dumps() converts python object it a json string + status=200, #this refers to the http requests has been succesfully served + mimetype='application/json' #format of the response data + ) + + return response + + +@app.route('/metrics') +def metrics(): + response = app.response_class( + response=json.dumps({"status":"success","code":0,"data":{"UserCount": 140, "UserCountActive": 23}}), #json.dumps() converts python object it a json string + status=200, #this refers to the http requests has been succesfully served + mimetype='application/json' #format of the response data + ) + + return response + @app.route("/") def hello(): return "Hello World!"