-
Notifications
You must be signed in to change notification settings - Fork 0
/
flask_app.py
executable file
·38 lines (35 loc) · 1.11 KB
/
flask_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
from os import urandom
from flask import Flask, jsonify, make_response
app = Flask(__name__)
@app.route("/ping", methods=['GET'])
def hello():
res = {"foo":"pong"}
return jsonify(res)
# Returns larger sample JSON from http://json.org/example.html to exercise performance with larger payloads
@app.route("/pong", methods=['GET'])
def big_response():
return '''{
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossDef": {
"para": "A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso": ["GML", "XML"]
},
"GlossSee": "markup"
}
}
}
}
}'''
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5555)