Exemplo n.º 1
0
def testAPNSWrapper(encoded_token, cert_path='iphone_cert.pem', sandbox=True):
    cert_path = 'iphone_cert.pem'

    """
    Method to testing apns-wrapper module.
    """

    wrapper = APNSNotificationWrapper(cert_path,
                                      sandbox=sandbox,
                                      debug_ssl=True,
                                      force_ssl_command=False)
    badge(wrapper, encoded_token)
    sound(wrapper, encoded_token)
    alert(wrapper, encoded_token)
    wrapper.connect()
    wrapper.notify()
    wrapper.disconnect()

    feedback = APNSFeedbackWrapper(cert_path,
                                   sandbox=sandbox,
                                   debug_ssl=True,
                                   force_ssl_command=False)
    feedback.receive()

    print "\n".join(["> " + base64.standard_b64encode(y) for x, y in feedback])
Exemplo n.º 2
0
    def cleanupPush(self, noop=False):
        # Only run this on prod
        if not IS_PROD or noop:
            logs.info("Skipping APNS cleanup (not prod / noop)")
            return

        feedback = APNSFeedbackWrapper(self._apnsCert, sandbox=self._sandbox)

        for d, t in feedback.tuples():
            token = binascii.hexlify(t)
            try:
                self._accountDB.removeAPNSToken(token)
                logs.debug("Removed token: %s" % token)
            except Exception as e:
                logs.debug("Failed to remove token: %s" % token)
Exemplo n.º 3
0
def testAPNSWrapper(encoded_token, cert_path, sandbox=True):
    """
    Method to testing apns-wrapper module.
    """

    wrapper = APNSNotificationWrapper(cert_path,
                                      sandbox=sandbox,
                                      debug_ssl=True,
                                      force_ssl_command=False)
    badge(wrapper, encoded_token)
    sound(wrapper, encoded_token)
    alert(wrapper, encoded_token)
    wrapper.connect()
    wrapper.notify()
    wrapper.disconnect()

    feedback = APNSFeedbackWrapper(cert_path,
                                   sandbox=sandbox,
                                   debug_ssl=True,
                                   force_ssl_command=False)
    feedback.receive()

    print "\n".join(["> " + base64.standard_b64encode(y) for x, y in feedback])