First part of T56 (crash server)

This commit is contained in:
Marko Budiselic 2016-06-16 20:38:05 +01:00
parent 83f094a15f
commit 62a58f05b5
4 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,9 @@
FROM python:3.5
COPY src/crash_analysis/server /server
RUN pip install -r /server/requirements.txt
WORKDIR /server
CMD python app.py

1
src/crash_analysis/server/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
ve/

View File

@ -0,0 +1,19 @@
import json
from flask import Flask, request
app = Flask(__name__)
@app.route("/crash", methods=["POST"])
def crash():
'''
Appends json body to a log file and print it to the stdout.
'''
body_dump = json.dumps(request.json)
with open("crash.log", "a") as f:
f.write(body_dump)
f.write('\n')
print(body_dump)
return '', 204
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8080)

View File

@ -0,0 +1,6 @@
click==6.6
Flask==0.11.1
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
Werkzeug==0.11.10