您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12 行
409 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. message = obj['message'].replace('\n', ' ')
  7. return f'{obj["title"]} - {message}{evalMatchesStr}'
  8. else:
  9. return f'{obj["title"]}{evalMatchesStr}'