|
|
发表于 2018-12-27 12:42:33
|
显示全部楼层
python也有
- #!/usr/bin/env python3
-
- import json
- import requests
- import sys
-
- def send_msg(url, phones, msg):
- headers = {'Content-Type': 'application/json;charset=utf-8'}
- data = {
- "msgtype": "text",
- "at": {
- "atMobiles": phones,
- "isAtAll": False,
- },
- "text": {
- "content": msg,
- }
- }
- r = requests.post(url, data=json.dumps(data), headers=headers)
- return r.text
-
- if __name__ == '__main__':
- msg = sys.argv[1]
- phones = []
- url = 'https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
- # print(send_msg(url, phones, msg))
- send_msg(url, phones, msg)
复制代码 |
|