diff --git a/app/__pycache__/main.cpython-310.pyc b/app/__pycache__/main.cpython-310.pyc new file mode 100644 index 0000000..01299a8 Binary files /dev/null and b/app/__pycache__/main.cpython-310.pyc differ diff --git a/app/main.py b/app/main.py index bb304f3..5d58f92 100644 --- a/app/main.py +++ b/app/main.py @@ -1,5 +1,6 @@ from fastapi import FastAPI import requests +import json app = FastAPI() @@ -15,6 +16,9 @@ async def root(): async def root(): headers = {'Content-Type': 'application/json'} # https://open.feishu.cn/open-apis/bot/v2/hook/5fb1b44c-3446-42ef-9b3a-dd37731567dd - r = requests.post('https://httpbin.org/post', - data={'msg_type': 'text', "content": {"text": "request example"}}, headers=headers) + try: + r = requests.post('https://open.feishu.cn/open-apis/bot/v2/hook/5fb1b44c-3446-42ef-9b3a-dd37731567dd', + data=json.dumps({'msg_type': 'text', "content": {"text": "request example"}}), headers=headers) + except(e): + print('e') return {"message": "触发飞书webhook"}