我成功地设法使用示例,使用 certifer.cer 和 key.key 建立与APNS服务器的连接。
我希望运行一个Python脚本来自动推送通知,并希望使用 pyapns2 为此。但是,在创建 apnsclient()实例时,我无法弄清楚如何向证书提供键。使用readme.md示例中提供的任何一个文件都不起作用:
client = APNsClient('key.pem', use_sandbox=False, use_alternative_port=False)
我还考虑将两个文件合并到一个文件中,但是描述的方法在这里在合并过程中抛出错误:无法加载证书”。我不确定这是我应该走的道路。
有什么建议吗?另外,有人可以建议基于Python的API向APN发送推送通知吗?
I successfully managed to send push notifications from command line using the Send a Push Notification Using a Certificate example, which uses both the certificate.cer and the key.key to establish the connection with the APNs server.
I wish to run a python script to automate push notifications and wanted to use PyAPNs2 module for that. However, I cannot figure out how to provide the certificate the the key when creating the APNsClient() instance. Using either file as provided in the README.md example does not work:
client = APNsClient('key.pem', use_sandbox=False, use_alternative_port=False)
I also looked into merging the two files into one, but the approach described here throws an error during merging: "unable to load certificates". I am not sure that's the path I should take.
Any suggestions? Alternatively, can someone suggest a good python based API for sending push notifications to the APNs?
发布评论