From 22a766d0ade3bff127d8a116dfab1ee3f0483534 Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 14 Dec 2022 14:18:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E9=A3=9E=E4=B9=A6?= =?UTF-8?q?=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/main.py b/app/main.py index ee60be1..bb304f3 100644 --- a/app/main.py +++ b/app/main.py @@ -1,4 +1,5 @@ from fastapi import FastAPI +import requests app = FastAPI() @@ -6,3 +7,14 @@ app = FastAPI() @app.get("/") async def root(): return {"message": "Hello World"} + +# 飞书通知 + + +@app.get("/feishu") +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) + return {"message": "触发飞书webhook"}