25 lines
670 B
Python
25 lines
670 B
Python
from fastapi import FastAPI
|
|
import requests
|
|
import json
|
|
|
|
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
|
|
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": "cityNew有新用户注册"}}), headers=headers)
|
|
except(e):
|
|
print('e')
|
|
return {"message": "触发飞书webhook"}
|