Skip to content

Commit e051a7c

Browse files
committed
Small changes
1 parent fd6822c commit e051a7c

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

firebase_admin/_messaging_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class MulticastMessage(object):
7272
def __init__(self, tokens, data=None, notification=None, android=None, webpush=None, apns=None):
7373
_Validators.check_string_list('MulticastMessage.tokens', tokens)
7474
if len(tokens) > 100:
75-
raise ValueError('MulticastMessage.tokens must contain less than 100 tokens.')
75+
raise ValueError('MulticastMessage.tokens must not contain more than 100 tokens.')
7676
self.tokens = tokens
7777
self.data = data
7878
self.notification = notification

firebase_admin/messaging.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def send(message, dry_run=False, app=None):
100100
return _get_messaging_service(app).send(message, dry_run)
101101

102102
def send_all(messages, dry_run=False, app=None):
103-
"""Batch sends the given messages via Firebase Cloud Messaging (FCM).
103+
"""Sends the given list of messages via Firebase Cloud Messaging as a single batch.
104104
105105
If the ``dry_run`` mode is enabled, the message will not be actually delivered to the
106106
recipients. Instead FCM performs all the usual validations, and emulates the send operation.
@@ -258,10 +258,7 @@ class BatchResponse(object):
258258

259259
def __init__(self, responses):
260260
self._responses = responses
261-
self._success_count = 0
262-
for response in responses:
263-
if response.success:
264-
self._success_count += 1
261+
self._success_count = len([resp for resp in responses if resp.success])
265262

266263
@property
267264
def responses(self):
@@ -455,7 +452,7 @@ def _message_data(self, message, dry_run):
455452

456453
def _postproc(self, resp, body):
457454
if resp.status == 200:
458-
return json.loads(body)
455+
return json.loads(response.decode())
459456
else:
460457
raise Exception('unexpected response')
461458

0 commit comments

Comments
 (0)