matrix-webhook/matrix_webhook/formatters/grafana_9x.py

10 lines
313 B
Python
Raw Permalink Normal View History

def grafana_9x(data, headers):
"""Pretty-print a Grafana newer than v9.x notification."""
text = ""
if "title" in data:
text = "#### " + data["title"] + "\n"
if "message" in data:
text = text + data["message"].replace("\n", "\n\n") + "\n\n"
data["body"] = text
return data