kukosk / pyapns_client

Simple, flexible and fast Apple Push Notifications on iOS, OSX and Safari using the HTTP/2 Push provider API.
Other
25 stars 11 forks source link

Getting this everytime: 'check your code and try again later' #14

Closed jerrypaulsam closed 1 year ago

jerrypaulsam commented 1 year ago

alert = IOSPayloadAlert(title=f"Call From {name}", subtitle='Incoming call', body=f'Incoming call from {name}') payload = IOSPayload(alert=alert) notification = IOSNotification(payload=payload, topic='com.company.app', push_type="voip",)

with APNSClient(mode=APNSClient.MODE_PROD, authentificator=TokenBasedAuth( auth_key_path=f"{settings.APNS_AUTH_KEY}", auth_key_id=settings.APNS_KEY_ID, team_id='XXXXXXX' ), root_cert_path=None,)

as client: try: client.push(notification=notification, device_token=apn_token)

                except UnregisteredException as e:
                    logger.info(f'device is unregistered, compare timestamp {e.timestamp_datetime} and remove from db')
                except APNSDeviceException:
                    logger.info('flag the device as potentially invalid and remove from db after a few tries')
                except APNSServerException:
                    logger.info(f"try again later")
                except APNSProgrammingException:
                    logger.info('check your code and try again later')

                else:
                    logger.info('everything is ok')

I don't understand why this error is showing.