Compare commits

...

1 commit

Author SHA1 Message Date
Théophile Bastian 2a296c09d1 Dump json 2022-03-23 17:00:44 +01:00

View file

@ -1,3 +1,4 @@
import json
import typing as t
from flask import Flask, request
from . import signal
@ -13,6 +14,10 @@ def root() -> t.Tuple[str, int]:
@app.route("/alertmanager", methods=["POST"])
def alertmanager():
data = request.get_json(cache=False)
with open("/tmp/dump.json", "w") as handle:
handle.write(json.dumps(data))
if "version" not in data or int(data["version"]) != 4:
return "Bad API version", 400
if "alerts" not in data: