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