1234567891011121314151617181920212223242526272829303132333435363738394041 |
- """
- @author: luojunhui
- """
- import json
- import requests
- from applications.decoratorApi import retryOnTimeout
- @retryOnTimeout()
- def bot(title, detail):
- """
- 机器人
- """
- url = "https://open.feishu.cn/open-apis/bot/v2/hook/b44333f2-16c0-4cb1-af01-d135f8704410"
- headers = {"Content-Type": "application/json"}
- payload = {
- "msg_type": "interactive",
- "card": {
- "elements": [
- {
- "tag": "div",
- "text": {
- "content": "{}<at id=all></at>\n".format(title),
- "tag": "lark_md",
- },
- },
- {
- "tag": "div",
- "text": {
- "content": json.dumps(
- detail, ensure_ascii=False, indent=4
- ),
- "tag": "lark_md",
- },
- },
- ],
- "header": {"title": {"content": "【重点关注】", "tag": "plain_text"}},
- },
- }
- requests.request("POST", url=url, headers=headers, data=json.dumps(payload), timeout=10)
|