钉钉消息

2020-01-04  本文已影响0人  Habit_1027

一、自定义机器人

image image image image image image image

郑重警告⚠️

每个机器人每分钟只可以发送 20 条信息,多了,会被禁止使用 10 分钟.

shell 示例代码

msg='shark:我就是我'
url="https://oapi.dingtalk.com/robot/send?access_token=bd5fb98176ad5c5a1a34cb7147cac10c847e9c37e3c31e30311cc413079c899f"
curl $url \
   -H 'Content-Type: application/json' \
   -d '{"msgtype": "text",
        "text": {
             "content": "'${msg}'"
        }
      }'

python 示例代码

import requests

content = {
    "msgtype": "text",
    "text": {
        "content": "出发!"
    },
    "at": {
#        "atMobiles": [
#            # 单独 @ 某个人
#            "131xxxxxx81"
#        ],
#        "isAtAll": False

        # @ 所有人
        "isAtAll": True
    }
}

headers = {"Content-Type": "application/json;charset=utf-8"}

url = "https://oapi.dingtalk.com/robot/send?access_token=xxx"

r = requests.post(url=url,headers=headers,json=content)
print(r.content)

</article>

0人点赞

Python3基础语法(课件)

上一篇下一篇

猜你喜欢

热点阅读