Есть функция для отправки сообщений
PUSH_NOTIFICATIONS_SETTINGS = {
"APNS_CERTIFICATE": os.path.join(PROJECT_ROOT, 'rss/CorruptionDevPushCer.p12'),
}
from rss.settings import PUSH_NOTIFICATIONS_SETTINGS
def send_message(data, kwargs):
device_apns_ids = [d.device_id for d in UserDevice.objects.filter(client=client, active=True, device=2).all()]
cert_file = PUSH_NOTIFICATIONS_SETTINGS['APNS_CERTIFICATE']
apns_enhanced = APNs(use_sandbox=True, cert_file=cert_file, enhanced=True)
payload = Payload(alert=kwargs['pid'], sound="default", badge=1)
frame = Frame()
identifier = 1
expiry = time.time() + 3600
priority = 10
for device_apns_id in device_apns_ids:
device_apns_id = str(device_apns_id)
frame.add_item(device_apns_id, payload, identifier, expiry, priority)
apns_responce = apns_enhanced.gateway_server.send_notification_multiple(frame)
Результат работы
[Errno 336265218] _ssl.c:355: error:140B0002:SSL routines:SSL_CTX_use_PrivateKey_file:system lib
Где ошибка?
Путь к сертификату aplication/rss