DingTalkUtils.py 552 B

12345678910111213141516171819202122
  1. import requests
  2. url = "https://oapi.dingtalk.com/robot/send?access_token=8c4c99b4b2ca152fb0a5f21b368fae743a64b4ccecac01548a8620fe7f63a0ca"
  3. headers = {'Content-Type': 'application/json;charset=utf-8'}
  4. def send(msg):
  5. data = {'msgtype': 'text',
  6. "at": {"isAtAll": True,
  7. "atMobiles": []},
  8. "text": {"content": "[代码发布]"+msg}}
  9. requests.post(url=url, headers=headers, json=data)
  10. if __name__ == '__main__':
  11. send("双击打开撒就发了")
  12. # 发送的内容得加上趣程