You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
369 B

  1. import json
  2. async def process(request):
  3. obj = json.loads(await request.text())
  4. evalMatchesStr = (': ' + ', '.join(f'{x["metric"]} = {x["value"]}' for x in obj['evalMatches'])) if 'evalMatches' in obj and obj['evalMatches'] else ''
  5. if 'message' in obj:
  6. return f'{obj["title"]} - {obj["message"]}{evalMatchesStr}'
  7. else:
  8. return f'{obj["title"]}{evalMatchesStr}'