import urllib3,certifi
import hashlib
import base64, json
content_a = {
"ecName": "*********************",
"apId": "*********************",
"mobiles": "182********,135********",
"content": "***************** 短信接口测试.",
"sign": "*****************",
"addSerial": "",
"mac": ""
}
secret_key = '*****************'
g_mac = hashlib.md5()
g_mac_cont = content_a['ecName'] + content_a['apId'] + secret_key + content_a['mobiles'] \
+ content_a['content'] + content_a['sign'] + content_a['addSerial']
g_mac.update(g_mac_cont.encode('utf-8'))
content_a["mac"] = (g_mac.hexdigest()).lower()
http_pool = urllib3.PoolManager(cert_reqs='CERT_NONE')
encoding_content = base64.b64encode(json.dumps(content_a).encode('utf-8'))
response = http_pool.request("POST", "https://112.35.10.201:28888/sms/submit",
body=encoding_content, headers={'Content-Type': 'application/json'})
print(response.status)
print(response.data)
1. 云平台的首页下方有API文档
2. https的IP:Port是112.35.10.201:28888,这个是加客服的QQ要的,文档里没有,HTTP的应该是这个 [112.35.1.155:1992]