ding_robot.py 497 B

1234567891011121314151617
  1. import requests
  2. url = "https://oapi.dingtalk.com/robot/send?access_token=2add07f31eb0245fa45eed86101253363813b5e70c4d55d0aeb0df2f8b421372"
  3. def sendDingMsg(error_type, error_message):
  4. # 'Content-Type' => 'application/json'
  5. headers = {
  6. "Content-Type": "application/json"
  7. }
  8. data = {
  9. "text": {
  10. "content": f"【拍照机】异常-{error_type}\n{error_message}"
  11. },
  12. "msgtype": "text"
  13. }
  14. requests.post(url, json=data, headers=headers)