我想實現使用Python和Django的蘋果推送通知。SSL錯誤而實施蘋果推送通知
我使用下面庫來實現它
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證書或兩者都有問題。您是否按照設置證書的說明進行操作? – jathanism 2011-04-26 13:12:58
嗯,我有一個.pem文件,我已經指定了該文件的路徑,現在我不知道如何設置證書,請問您能否詳細告訴我 – Hunt 2011-04-26 13:24:17