【发布时间】:2018-04-27 14:18:40
【问题描述】:
我正在尝试使用 python 和 django 实现 Apple 推送通知。
我正在使用以下库来实现它
http://leepa.github.com/django-iphone-push/
这是我创建发送消息的代码
from django.http import HttpResponse
from django.utils import simplejson
import json
from push.models import iPhone
def SendMessage(request,data):
t = iPhone('XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX ') # 64 digit token
t.send_message("hi") # at this line i am getting ERROR
return HttpResponse(data,mimetype='application/javascript')
settings.py
import os
PROJECT_ROOT = '/'
# Full path to the APN Certificate / Private Key .pem
IPHONE_SANDBOX_APN_PUSH_CERT = os.path.join(PROJECT_ROOT, "apns-dev-tubeteam.pem")
IPHONE_LIVE_APN_PUSH_CERT = os.path.join(PROJECT_ROOT, "apns-dev-tubeteam.pem")
# Set this to the hostname for the outgoing push server
IPHONE_SANDBOX_APN_HOST = 'gateway.sandbox.push.apple.com'
IPHONE_LIVE_APN_HOST = 'gateway.push.apple.com'
# Set this to the hostname for the feedback server
IPHONE_SANDBOX_FEEDBACK_HOST = 'feedback.sandbox.push.apple.com'
IPHONE_LIVE_FEEDBACK_HOST = 'feedback.push.apple.com'
错误
[Errno 336265218] _ssl.c:337: error:140B0002:SSL routines:SSL_CTX_use_PrivateKey_file:system lib
谁能告诉我如何摆脱它。
【问题讨论】:
-
你读过错误吗?很明显,您的 64 位令牌或 SSL 证书或两者都有问题。您是否按照设置证书的说明进行操作?
-
我确实有一个 .pem 文件,我已经指定了该文件的路径,现在我不知道如何设置证书,请您详细告诉我
标签: python django apple-push-notifications