Files
gitlab-instance-0a899031_fa…/app/main.py
2022-12-14 14:18:53 +08:00

21 lines
530 B
Python

from fastapi import FastAPI
import requests
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"}