Closed SanghoYang closed 3 years ago
Hi,
I wonder there is any reason why it returns True instead of response in the method, _send_push_request() in the class, APNsClient.
def _send_push_request(self, connection, registration_id, json_data, request_headers): connection.request( 'POST', '/3/device/{0}'.format(registration_id), json_data, headers=request_headers ) response = connection.get_response() if response.status != APNSResponse.Success: identifier = response.headers['apns-id'] body = json.loads(response.read().decode('utf-8')) reason = body["reason"] if "reason" in body else None if reason: exceptions_module = importlib.import_module("gobiko.apns.exceptions") ExceptionClass = None try: ExceptionClass = getattr(exceptions_module, reason) except AttributeError: ExceptionClass = InternalException raise ExceptionClass() return True
And, how about changing it into returning response?
Thanks.
Done: https://github.com/genesluder/python-apns/commit/215b9f8880d15c53e3bbab2dc8f388a482dc6d7f
Hi,
I wonder there is any reason why it returns True instead of response in the method, _send_push_request() in the class, APNsClient.
And, how about changing it into returning response?
Thanks.