From 2a296c09d11a838c99c3d033b4817f4af747b841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Wed, 23 Mar 2022 17:00:44 +0100 Subject: [PATCH] Dump json --- signal_webhook/app.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/signal_webhook/app.py b/signal_webhook/app.py index ffcf84e..4bfcc5e 100644 --- a/signal_webhook/app.py +++ b/signal_webhook/app.py @@ -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: