如何将PYAPNS2与证书和钥匙使用?

发布于 2025-02-11 07:47:23 字数 1005 浏览 1 评论 0 原文

我成功地设法使用示例,使用 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文