def send(self, message_text): payload = json.dumps({'text': message_text}) if check_that_remote_connections_are_okay('SLACK POST:', payload): celery_request('POST', url=self.webhook_url, data=payload, headers=self.headers)
def send(self, message_text): payload = json.dumps({ 'text': message_text }) if check_that_remote_connections_are_okay( 'SLACK POST:', payload): celery_request('POST', url=self.webhook_url, data=payload, headers=self.headers)
def send_mailgun_email(to, message, sender_profile, subject): post_data = { "from": "{name} <{email}>".format( name=sender_profile.name, email=sender_profile.get_clearmyrecord_email()), "to": [to], "subject": subject, "text": message } tasks.celery_request( 'POST', MAILGUN_MESSAGES_API_URL, auth=mailgun_auth(), data=post_data)
def send(self, to, body, subject=None): if isinstance(to, str): to = [to] data = { 'body': body.replace('\n', '<br>'), 'text': body, 'to': to, 'options': { 'archive': True } } if subject: data.update(subject=subject) payload = json.dumps(data) if check_that_remote_connections_are_okay('FRONT POST:', payload): celery_request('POST', url=self.build_api_url_endpoint(), data=payload, headers=self.build_headers())
def send(self, to, body, subject=None): if isinstance(to, str): to = [to] data = { 'body': body.replace('\n', '<br>'), 'text': body, 'to': to, 'options': { 'archive': True } } if subject: data.update(subject=subject) payload = json.dumps(data) if check_that_remote_connections_are_okay( 'FRONT POST:', payload): celery_request('POST', url=self.build_api_url_endpoint(), data=payload, headers=self.build_headers() )