- fix issue with returned reason
This commit is contained in:
+2
-2
@@ -90,7 +90,7 @@ class APNsClient(object):
|
|||||||
priority: NotificationPriority = NotificationPriority.Immediate,
|
priority: NotificationPriority = NotificationPriority.Immediate,
|
||||||
expiration: Optional[int] = None, collapse_id: Optional[str] = None) -> None:
|
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)
|
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)
|
print(123, result)
|
||||||
if result != 'Success':
|
if result != 'Success':
|
||||||
if isinstance(result, tuple):
|
if isinstance(result, tuple):
|
||||||
@@ -143,7 +143,7 @@ class APNsClient(object):
|
|||||||
|
|
||||||
url = '/3/device/{}'.format(token_hex)
|
url = '/3/device/{}'.format(token_hex)
|
||||||
response = self.__client.post('https://{}{}'.format(self.__server, url), headers=headers, data=json_payload)
|
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]]:
|
def get_notification_result(self, status: int, reason: str) -> Union[str, Tuple[str, str]]:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user