formatters: also get headers
This commit is contained in:
parent
ac7d1d9647
commit
4bcdb25c80
3 changed files with 10 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
"""Formatters for matrix webhook."""
|
||||
|
||||
|
||||
def grafana(data):
|
||||
def grafana(data, headers):
|
||||
"""Pretty-print a grafana notification."""
|
||||
text = ""
|
||||
if "title" in data:
|
||||
|
|
|
@ -35,7 +35,9 @@ async def matrix_webhook(request):
|
|||
|
||||
if "formatter" in request.rel_url.query:
|
||||
try:
|
||||
data = getattr(formatters, request.rel_url.query["formatter"])(data)
|
||||
data = getattr(formatters, request.rel_url.query["formatter"])(
|
||||
data, request.headers
|
||||
)
|
||||
except AttributeError:
|
||||
return utils.create_json_response(
|
||||
HTTPStatus.BAD_REQUEST, "Unknown formatter"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue