小编eli*_*oty的帖子

使用Python连接到iPhone的APNS

我正在尝试使用Python向iPhone发送推送通知.我已经将我的证书和私钥从keychain访问导出到p12文件中,然后使用以下命令将其转换为pem文件:

openssl pkcs12 -in cred.p12 -out cert.pem -nodes -clcerts
Run Code Online (Sandbox Code Playgroud)

我正在使用Python中的APNSWrapper进行连接.

我运行以下代码:

deviceToken = 'Qun\xaa\xd ... c0\x9c\xf6\xca' 

# create wrapper
wrapper = APNSNotificationWrapper('/path/to/cert/cert.pem', True)

# create message
message = APNSNotification()
message.token(deviceToken)
message.badge(5)

# add message to tuple and send it to APNS server
wrapper.append(message)
wrapper.notify()

然后我收到错误消息:

ssl.SSLError: (1, '_ssl.c:485: 
error:14094416:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate unknown')

任何人都可以帮我解决这个问题吗?

python iphone ssl push-notification

12
推荐指数
1
解决办法
1万
查看次数

标签 统计

iphone ×1

push-notification ×1

python ×1

ssl ×1