Python2.7.11
$ sudo pip install pyapns
$ twistd -r epoll web --class=pyapns.server.APNSServer --port=7077
from pyapns import configure, provision, notify
configure({'HOST': 'http://localhost:7077/'})
provision('app-name', open('cert.pem').read(), 'sandbox')
payload = {'aps': {
'alert': {
'sound': 'default',
'badge': 0,
'body': 'Hello World!',
'message': 'Push Notification from Python!!'
},
'uri': 'https://nnsnodnb.moe'
}}
notify('app-name', 'hexlified_token_str', payload)
Es ist schön, damit Push-Benachrichtigungen während der Entwicklung einfach testen zu können! !!
Recommended Posts