I have used PyAPNS https://github.com/simonwhitaker/PyAPNs for this with 
some degree of success in the past.

What I do is to send the notifications 1 by 1 which is quite slow but at 
least you can catch invalid tokens. This is the relevant part of the code I 
use:

    for device in ios_devices:
        try:
            apns.gateway_server.send_notification(device, payload)
        except socket.error as e:
            # Most likely cause of a broken pipe is this token being 
invalid! (maybe the user uninstalled)
            apns = APNs(use_sandbox=False, cert_file=cert, key_file=key)
            logger.debug('SOCKET ERROR - ' + str(e.errno) + ' deleting ' + 
device)
            db((db.push_devices.platform == 'ios') & 
(db.push_devices.device_id_or_token == device)).delete()
            continue

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to