

def send_messages(self, email_messages):
    '\n        Sends one or more EmailMessage objects and returns the number of email\n        messages sent.\n        '
    if (not email_messages):
        return
    num_sent = 0
    for message in email_messages:
        try:
            mail = self._create_mail(message)
            if mail:
                self.client.send(mail)
                num_sent += 1
        except sendgrid.SendGridClientError:
            if (not self.fail_silently):
                raise
        except sendgrid.SendGridServerError:
            if (not self.fail_silently):
                raise
    return num_sent

dataset/ETHPy150Open crowdresearch/crowdsource-platform/crowdsourcing/backends/sendgrid_backend.py SendGridBackend.send_messages/original