标签:ppc .post values host url sage [1] content 脚本
#!/usr/bin/env pythonimport sys
import requests
import json
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‘}
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)
标签:ppc .post values host url sage [1] content 脚本
原文地址:http://blog.51cto.com/gravel/2329962