关于HMS服务端报错,求助。。。
首先感觉有点乱,在网上搜到几篇关于HMS接口文档,内容不完全不同.
先上我的代码吧,为了安全,部分参数已去掉,通过华为控制台发送的消息,客户端可以正常收到。现在服务端总是搞不好,返回 内容为: "error":"params err" ,求高人指点
appSecret = "这个已修改"
appId = "这个已修改"
url="接口地址" #无法发表带链接的文章,所以修改了
posturl = apiUrl + "?nsp_ctx=" + urllib.quote_plus(str("{\"ver\":\"1\", \"appId\":\"" + appId + "\"}"))
headers={'Content-Type':'application/x-www-form-urlencoded'}
access_token="这个已修改" #服务端 AccessToken
device_token_list=';'.join(['这个已修改'])#客户端 token
nsp_svc="openpush.message.api.send" #固定值
nsp_ts=time.strftime("%s",time.gmtime(time.time())) #服务请求时间戳
postbody={"access_token":access_token.encode("utf-8"),"nsp_svc":nsp_svc.encode("utf-8"),"nsp_ts":nsp_ts.encode("utf-8"),"device_token_list":device_token_list.encode("utf-8"),"payload":str(payload).encode("utf-8")}
req=urllib2.Request(posturl,urllib.urlencode(postbody),headers)
response = urllib2.urlopen(req)
result = response.read()
#result 返回 "error":"parram error"

2
浏览1788 发布于2018-07-17 18:03未知归属地