[英]iphone push notifications passphrase issue (pyAPns)
I'm trying to implement push notifications for iphone based on PyAPNs 我正在尝试基于PyAPN为iPhone实现推送通知
When I run it on local but it blocks and prompts me to enter the passphrase manually and doesn't work until I do 当我在本地运行它时,它阻止并提示我手动输入密码,直到我这样做才起作用
I don't know how to set it up so to work without prompt 我不知道如何设置它,以便在没有提示的情况下工作
This is my code: 这是我的代码:
from apns import APNs, Payload
import optparse
import os
certificate_file = here(".." + app.fichier_PEM.url )
token_hex = '0c99bb3d077eeacdc04667d38dd10ca1a'
pass_phrase = app.mot_de_passe
apns = APNs(use_sandbox=True, cert_file= certificate_file)
payload = Payload(alert = message.decode('utf-8'), sound="default", badge=1)
apns.gateway_server.send_notification(token_hex, payload)
# Get feedback messages
for (token_hex, fail_time) in apns.feedback_server.items():
print "fail: "+fail_time
When you create a .pem file without phrase specify -nodes
创建不带短语的.pem文件时,请指定
-nodes
To Create .pem file without phrase
创建不带短语的.pem文件
openssl pkcs12 -nocerts -out Pro_Key.pem -in App.p12 -nodes
To Create .pem file with phrase
用短语创建.pem文件
openssl pkcs12 -nocerts -out Pro_Key.pem -in App.p12
If you have a .pem file with password you can get rid of its password for PyAPNs using the following
如果您有一个带有密码的.pem文件,则可以使用以下方法来
删除其PyAPN的密码
openssl rsa -in haspassword.pem -out nopassword.pem
Refer 参考
for make certificates and other configurations. 用于制作证书和其他配置。
Some Python library for interacting with the Apple Push Notification service (APNs) 一些Python库,用于与Apple Push Notification Service(APN)进行交互
Try to use 尝试使用
apns = APNs(use_sandbox=True, cert_file='XYZCert.pem', key_file='XYZKey.pem')
where you specify both the certificate and the private key. 您在其中指定证书和私钥。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.