- fix issue with returned reason

This commit is contained in:
2022-04-20 09:31:16 +03:00
parent 3aeb5fe477
commit 28ac695a78
+2 -2
View File
@@ -90,7 +90,7 @@ class APNsClient(object):
priority: NotificationPriority = NotificationPriority.Immediate,
expiration: Optional[int] = None, collapse_id: Optional[str] = None) -> None:
stream_id, reason = self.send_notification_async(token_hex, notification, topic, priority, expiration, collapse_id)
result = self.get_notification_result(stream_id, reason)
result = self.get_notification_result(stream_id, reason.get('reason'))
print(123, result)
if result != 'Success':
if isinstance(result, tuple):
@@ -143,7 +143,7 @@ class APNsClient(object):
url = '/3/device/{}'.format(token_hex)
response = self.__client.post('https://{}{}'.format(self.__server, url), headers=headers, data=json_payload)
return response.status_code, response.text
return response.status_code, response.json()
def get_notification_result(self, status: int, reason: str) -> Union[str, Tuple[str, str]]:
"""