Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 40 lines (26 sloc) 0.993 kb
#!/usr/bin/env python
from apns import APNs, Payload
import optparse
import time
from tornado import ioloop
parser = optparse.OptionParser()
parser.add_option("-c", "--certificate-file",
dest="certificate_file",
help="Path to .pem certificate file")
parser.add_option("-k", "--key-file",
dest="key_file",
help="Path to .pem key file")
options, args = parser.parse_args()
if options.certificate_file is None:
parser.error('Must provide --certificate-file')
if options.key_file is None:
parser.error('Must provide --key-file')
apns = APNs(cert_file=options.certificate_file, key_file=options.key_file, use_sandbox=True)
def success(token_hex, fail_time):
print("Get feedback data token:%s fail_time:%s" % \
(token_hex,fail_time))
def receive():
apns.feedback_server.receive_feedback(success)
# receive feedback
apns.feedback_server.connect(receive)
ioloop.IOLoop.instance().start()
Jump to Line
Something went wrong with that request. Please try again.