diff --git a/pyfcm/__meta__.py b/pyfcm/__meta__.py index b9ddc35..d7f27da 100644 --- a/pyfcm/__meta__.py +++ b/pyfcm/__meta__.py @@ -5,7 +5,7 @@ __summary__ = 'Python client for FCM - Firebase Cloud Messaging (Android & iOS)..' __url__ = 'https://github.com/olucurious/pyfcm' -__version__ = '1.3.1' +__version__ = '1.3.2' __install_requires__ = ['requests', 'requests-toolbelt'] diff --git a/pyfcm/baseapi.py b/pyfcm/baseapi.py index 296a094..23ec11f 100644 --- a/pyfcm/baseapi.py +++ b/pyfcm/baseapi.py @@ -230,23 +230,23 @@ def parse_responses(self): Returns a python dict of multicast_id(long), success(int), failure(int), canonical_ids(int), results(list) """ if 'content-length' in response.headers and int(response.headers['content-length']) <= 0: - return {} - - parsed_response = response.json() + response_list.append({}) + else: + parsed_response = response.json() - multicast_id = parsed_response.get('multicast_id', None) - success = parsed_response.get('success', 0) - failure = parsed_response.get('failure', 0) - canonical_ids = parsed_response.get('canonical_ids', 0) - results = parsed_response.get('results', []) - message_id = parsed_response.get('message_id', None) # for topic messages - if message_id: - success = 1 - response_list.append({'multicast_id': multicast_id, - 'success': success, - 'failure': failure, - 'canonical_ids': canonical_ids, - 'results': results}) + multicast_id = parsed_response.get('multicast_id', None) + success = parsed_response.get('success', 0) + failure = parsed_response.get('failure', 0) + canonical_ids = parsed_response.get('canonical_ids', 0) + results = parsed_response.get('results', []) + message_id = parsed_response.get('message_id', None) # for topic messages + if message_id: + success = 1 + response_list.append({'multicast_id': multicast_id, + 'success': success, + 'failure': failure, + 'canonical_ids': canonical_ids, + 'results': results}) elif response.status_code == 401: raise AuthenticationError("There was an error authenticating the sender account") elif response.status_code == 400: