From 55977d9dc4debc869d2a10eb6946f305fd64881f Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Sat, 6 Apr 2019 19:22:48 +0200 Subject: [PATCH] [data] --- server/nightr/app.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server/nightr/app.py b/server/nightr/app.py index 07842cd..7ba6a99 100644 --- a/server/nightr/app.py +++ b/server/nightr/app.py @@ -34,11 +34,14 @@ strategies = { @app.route("/", methods=["GET", "POST"]) def probabilities(): - if request.method == 'GET': + if request.method == "GET": logger.warning("GET request: using default context parameters") - phone_data = request.get_json(force=True) - logger.debug("phone_data:\n%s", json.dumps(phone_data, indent=2)) - context = Context(**phone_data) + context = Context() + else: + phone_data = request.get_json(force=True) + logger.debug("phone_data:\n%s", json.dumps(phone_data, indent=2)) + context = Context(**phone_data["data"]) + logger.debug("Context: %s", context) predictions: List[dict] = []