iPhone推送通知密码问题(pyAPns) [英] iphone push notifications passphrase issue (pyAPns)

查看:191
本文介绍了iPhone推送通知密码问题(pyAPns)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现推送通知的基础上PyAPNs iphone

当我在本地运行,但它块,提示我手动输入密码,不工作,直到我

我不知道该如何设定,让无提示工作

这是我的code:

 从APNS进口的APN,有效载荷
进口optparse
进口OS
certificate_file =这里(..+ app.fichier_PEM.url)
token_hex ='0c99bb3d077eeacdc04667d38dd10ca1a
pass_phrase = app.mot_de_passeAPNS =的APN(use_sandbox = TRUE,cert_file中= certificate_file)
有效载荷=载荷(警报= message.de code(UTF-8),声音=默认,徽章= 1)
apns.gateway_server.send_notification(token_hex,有效载荷)
#得到反馈消息
在apns.feedback_server.items(token_hex,fail_time)():
    打印失败:+ fail_time


解决方案

在创建一个没有短语.pem文件指定 -nodes

创建没有短语.pem文件

  OpenSSL的PKCS12 -nocerts退房手续Pro_Key.pem -in App.p12 -nodes

要创建质子交换膜与短语文件

  OpenSSL的PKCS12 -nocerts退房手续Pro_Key.pem -in App.p12

如果你有一个.pem文件与密码,您可以获得了PyAPNs摆脱其​​密码
使用以下

  OpenSSL的RSA -in haspassword.pem退房手续nopassword.pem

请参照

有关化妆证书等配置。

一些Python库与苹果推送通知服务(的APN)的交互

I'm trying to implement push notifications for iphone based on PyAPNs

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

To Create .pem file without phrase

openssl pkcs12 -nocerts -out Pro_Key.pem -in App.p12 -nodes

To Create .pem file with phrase

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

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)

这篇关于iPhone推送通知密码问题(pyAPns)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆