python发送移动云mas2.0短信息(二平台、新平台)采坑记录

python发送移动云mas短信息(二平台、新平台)
采坑记录:重要事情说三遍(下面程序调用的是mas2.0!的接口,不是云mas1.0):
这是云mas2.0!的接口
这是云mas2.0!的接口
这是云mas2.0!的接口

一定要联系云mas主页上的客服QQ!!!

import pymysql
import time
import urllib3,certifi
import hashlib
import base64, json
#python发送移动云mas短信息(二平台、新平台)

content_a = {
    "ecName": "********",#用户名,登录平台时的用户名
    "apId": "********",#接口id,登录移动云mas后自己配置的,不是登录平台的账号
    "secretKey": "********",#接口密码,,登录移动云mas后自己配置的,不是登录平台的密码
    "mobiles": "151****9720,155****5930",#要发送至的手机号码,逗号隔开
    "content": "测试短信",#短信内容
    "sign": "****",#短信签名,从平台中下载
    "addSerial": "",#为空
    "mac": ""#空,程序生成
}
#生成md5的mac值,将ecName、apId、secretKey、mobiles、content、sign、addSerial进行无间隔拼接后生成32位的小写md5值
g_mac = hashlib.md5()
g_mac_cont = content_a['ecName'] + content_a['apId'] + content_a['secretKey'] + content_a['mobiles'] \
             + content_a['content'] + content_a['sign'] + content_a['addSerial']
print(g_mac_cont)
g_mac.update(g_mac_cont.encode('utf-8'))
content_a["mac"] = (g_mac.hexdigest()).lower()
#创建http_pool 池
http_pool = urllib3.PoolManager(cert_reqs='CERT_NONE')
#将content_a转为json字串后进行base64编码加密
encoding_content = base64.b64encode(json.dumps(content_a).encode('utf-8'))
strs = str(encoding_content,'utf-8')
print(json.dumps(content_a).encode('utf-8'))
print(strs)
#发送信息,更多接口见后面
#response = http_pool.request("POST", "https://112.35.10.201:28888/sms/submit",
response = http_pool.request("POST", "http://112.35.1.155:1992/sms/norsubmit",
                             body=strs, headers={'Content-Type': 'application/json','charset':'UTF-8'})
#读取响应
print(response.status)
print(response.data)

更多的移动云mas2.0接口地址:

CMPP2.0 112.35.10.164:1990
CMPP3.0 112.35.10.165:1991
HTTP 普通短信 http://112.35.1.155:1992/sms/norsubmit
HTTP 模板短信 http://112.35.1.155:1992/sms/tmpsubmit
Webservice http://112.35.10.201:1999/smsservice?wsdl
SDK java http://112.35.4.197:15000
https 普通短信 https://112.35.10.201:28888/sms/submit
https 模板短信 https://112.35.10.201:28888/sms/tmpsubmit

采坑记录:一直回复如下:
{“msgGroup”:"",“rspcod”:“InvalidUsrOrPwd”,“success”:false}
原来我用的是云mas2.0的接口,对接的是云mas1.0的平台

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值