Dump json
This commit is contained in:
parent
bc4639a055
commit
2a296c09d1
1 changed files with 5 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import json
|
||||||
import typing as t
|
import typing as t
|
||||||
from flask import Flask, request
|
from flask import Flask, request
|
||||||
from . import signal
|
from . import signal
|
||||||
|
@ -13,6 +14,10 @@ def root() -> t.Tuple[str, int]:
|
||||||
@app.route("/alertmanager", methods=["POST"])
|
@app.route("/alertmanager", methods=["POST"])
|
||||||
def alertmanager():
|
def alertmanager():
|
||||||
data = request.get_json(cache=False)
|
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:
|
if "version" not in data or int(data["version"]) != 4:
|
||||||
return "Bad API version", 400
|
return "Bad API version", 400
|
||||||
if "alerts" not in data:
|
if "alerts" not in data:
|
||||||
|
|
Loading…
Reference in a new issue