Compare commits
1 commit
8f1495cf0c
...
2a296c09d1
Author | SHA1 | Date | |
---|---|---|---|
Théophile Bastian | 2a296c09d1 |
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue