-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
41 lines (34 loc) · 1011 Bytes
/
main.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
39
40
41
from flask import Flask
app = Flask(__name__)
@app.route('/', methods=['POST'])
def home():
return "Everything's 200 OK."
@app.route('/config', methods=['GET'])
def getconfig():
from flask import jsonify
from quip4aha import config
return jsonify(config)
@app.route('/config', methods=['POST'])
def updateconfig():
from flask import request
from quip4aha import config, dump_config
for k, v in request.json.items():
config[k] = v
dump_config()
return "Done!"
@app.route('/assign', methods=['POST'])
def assign():
from AssignHost import AssignHost
return AssignHost()
@app.route('/newdoc', methods=['POST'])
def newdoc():
from NewDoc import NewDoc
return NewDoc()
@app.route('/updateweather', methods=['POST'])
def updateweather():
from UpdateWeather import UpdateWeather
return UpdateWeather()
@app.errorhandler(Exception)
def handle_exception(e):
from flask import jsonify
return jsonify(message=str(e)), getattr(e,'code',500)