iphone推送通知密码问题(pyAPns)

Arm*_*nce 14 python django push-notification apple-push-notifications django-1.2

我正在尝试基于PyAPN实现iphone的推送通知

当我在本地运行它但它阻止并提示我手动输入密码短语,直到我这样做才行

我不知道如何设置它以便在没有提示的情况下工作

这是我的代码:

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
Run Code Online (Sandbox Code Playgroud)

ico*_*ter 25

当您创建没有短语指定的.pem文件时 -nodes

创建没有短语的.pem文件

openssl pkcs12 -nocerts -out Pro_Key.pem -in App.p12 -nodes
Run Code Online (Sandbox Code Playgroud)

用短语创建.pem文件

openssl pkcs12 -nocerts -out Pro_Key.pem -in App.p12
Run Code Online (Sandbox Code Playgroud)

如果您有一个带密码的.pem文件,您可以使用以下内容删除PyAPN的密码

openssl rsa -in haspassword.pem -out nopassword.pem
Run Code Online (Sandbox Code Playgroud)

参考

用于制作证书和其他配置.

一些用于与Apple推送通知服务(APN)交互的Python库