|
|
|
@ -74,6 +74,13 @@ def write_to_db(data, dbpath):
|
|
|
|
|
conn.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.errorhandler(Exception)
|
|
|
|
|
def server_error(err):
|
|
|
|
|
"""catch all exception handler"""
|
|
|
|
|
app.logger.exception(err)
|
|
|
|
|
return "exception", 400
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/")
|
|
|
|
|
def test():
|
|
|
|
|
"""healthcheck endpoint with no logic; useful for loadbalancing checks."""
|
|
|
|
@ -83,12 +90,9 @@ def test():
|
|
|
|
|
@app.route("/weir", methods=["POST"])
|
|
|
|
|
def weir():
|
|
|
|
|
"""Primary app route."""
|
|
|
|
|
try:
|
|
|
|
|
python_dict = request.get_json()
|
|
|
|
|
write_to_db(python_dict, "warren.db")
|
|
|
|
|
return "OK"
|
|
|
|
|
except Exception as error:
|
|
|
|
|
return f"Error: {error}.", 400
|
|
|
|
|
python_dict = request.get_json()
|
|
|
|
|
write_to_db(python_dict, "warren.db")
|
|
|
|
|
return "OK"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|