forked from gem-spaas/powerplant-coding-challenge
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
28 lines (19 loc) · 612 Bytes
/
Copy pathserver.py
File metadata and controls
28 lines (19 loc) · 612 Bytes
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
from flask import Flask, request
from powerplant_payload import processing_output
import json
app = Flask(__name__)
@app.route('/help')
def help():
return "Coding challenge"
@app.route('/productionplan', methods=['POST'])
def productionplan():
if isinstance(request.json, dict):
# well, this is a strange case when request.json is a dict
print(f"The strange input: {request.json}")
input = request.json
else:
input = json.loads(request.json)
output = processing_output(input)
return output
if __name__ == '__main__':
app.run('0.0.0.0', port=8888)