#!/usr/bin/python
# -*- coding: utf-8 -*-import requestsimport jsonimport sysimport osheaders = {'Content-Type': 'application/json;charset=utf-8'}
api_url = "https://oapi.dingtalk.com/robot/send?access_token=xxxxxx"def msg(text):
json_text= { "msgtype": "text", "at": { "atMobiles": [ "120xxx", "130xxx" ], "isAtAll": False }, "text": { "content": text } } print requests.post(api_url,json.dumps(json_text),headers=headers).contentif __name__ == '__main__':
text = sys.argv[1] msg(text)