@@ -100,7 +100,7 @@ def send(message, dry_run=False, app=None):
100100    return  _get_messaging_service (app ).send (message , dry_run )
101101
102102def  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 (body . decode () )
459456        else :
460457            raise  Exception ('unexpected response' )
461458
@@ -498,7 +495,7 @@ def _parse_batch_error(self, error):
498495
499496        data  =  {}
500497        try :
501-             parsed_body  =  json .loads (error .content )
498+             parsed_body  =  json .loads (error .content . decode () )
502499            if  isinstance (parsed_body , dict ):
503500                data  =  parsed_body 
504501        except  ValueError :
0 commit comments