python 推送给 iOS 设备遇到的问题
python进行推送,推送成功,网页的也有推送的消息,但是ios 手机并没有收到
python代码
ios_msg = jpush.ios(alert="Hello, IOS JPush!", badge="+1", sound="a.caf", extras={'k1': 'v1'})
android_msg = jpush.android(alert="Hello, android msg")
_jpush = jpush.JPush(JIMKEY, JIMSECRET)
_jpush.set_logging("DEBUG")
push = _jpush.create_push()
push.audience = jpush.audience(
jpush.registration_id("191e35f7e012cfb16d7")
)
push.notification = jpush.notification(alert="Hello, JPush!", android=android_msg, ios=ios_msg)
push.platform = jpush.all_
try:
response = push.send()
except common.Unauthorized:
raise common.Unauthorized("Unauthorized")
except common.APIConnectionException:
raise common.APIConnectionException("conn error")
except common.JPushFailure:
print("JPushFailure")
except:
print("Exception")
控制台提示:
DEBUG:urllib3.connectionpool:https://api.jpush.cn:443 "POST /v3/push HTTP/1.1" 200 36
DEBUG:jpush:Received 200 response. Headers:
Server: nginx
Date: Tue, 31 Jul 2018 02:00:51 GMT
Content-Type: application/json
Content-Length: 36
Connection: keep-alive
X-Rate-Limit-Limit: 600
X-Rate-Limit-Remaining: 599
X-Rate-Limit-Reset: 60
X-Jpush-Msgid: 3826413303
X-Jpush-Timestamp: 1533002451042
Body:
b'{"sendno":"0","msg_id":"3826413303"}'
127.0.0.1 - - [31/Jul/2018 10:00:38] "POST /api/1.0/test HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [31/Jul/2018 10:00:38] "POST /api/1.0/test HTTP/1.1" 200 -
网页收到的了推送的
Message ID 3826413303
推送平台 android,winphone,ios-product
推送结果 已发送
audience {"registration_id":["191e35f7e012cfb16d7"]}
notification {"alert":"Hello, JPush!","android":{"alert":"Hello, android msg"},"ios":{"alert":"Hello, IOS JPush!","badge":"+1","extras":{"k1":"v1"},"sound":"a.caf"}}
message null
options {"time_to_live":86400}
ios 获取的的
PUSHService.registrationID=191e35f7e012cfb16d7