Log POST requests.
This commit is contained in:
parent
b0228de1bb
commit
e809c1ccd2
|
@ -1,4 +1,5 @@
|
|||
import inspect
|
||||
import json
|
||||
import statistics
|
||||
import timeit
|
||||
from dataclasses import asdict
|
||||
|
@ -7,7 +8,7 @@ from logging import DEBUG
|
|||
from typing import List
|
||||
|
||||
import requests_cache
|
||||
from flask import Flask, jsonify, logging
|
||||
from flask import Flask, jsonify, logging, request
|
||||
|
||||
from .strategies import miloStrats, iss, cars_in_traffic, tide_strat, upstairs_neighbour
|
||||
from .util import Context
|
||||
|
@ -33,8 +34,10 @@ strategies = {
|
|||
|
||||
@app.route("/", methods=["GET", "POST"])
|
||||
def probabilities():
|
||||
phone_data = {} # TODO: get from POST request
|
||||
phone_data = request.get_json(force=True)
|
||||
context = Context(**phone_data)
|
||||
logger.debug("phone_data:\n%s", json.dumps(phone_data, indent=2))
|
||||
logger.debug("Context: %s", context)
|
||||
|
||||
predictions: List[dict] = []
|
||||
for name, strategy in strategies.items():
|
||||
|
|
Loading…
Reference in a new issue