zabbix--python短信接口腳本

#!/usr/bin/env python
#-- coding: utf8 --python

import sys
import requests
import jsonjson

def sendsms(phone, subject, message):
"""
發送短信
"""
values = {"appCode": "ZBXSZ",
"businessType": "tz",
"businessNo": "adf324",
"phoneNums": phone,
"templCode": "bqjrtzZBXSZyzryy73760",
"atTime": "null",
"paramsBody": {
"value0": subject,
"value1": message
}
}
headers = {'Content-Type': 'application/json'}app

host = 'aps.bqjr.cn'
post_url = 'http://' + host + '/bqjr/msg/send'
response = requests.post(url=post_url, headers=headers, data=json.dumps(values))
try:
    req= requests.post(url=post_url, data=json.dumps(values))
    print req.content
except Exception, e:
    print e

if name == 'main':
phone = sys.argv[1]
subject = sys.argv[2]
message = sys.argv[3]
sendsms(phone, subject, message)ide

相關文章
相關標籤/搜索