Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
 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())
Ejemplo n.º 5
0
 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()
                        )