How to use the createsend.utils.validate_consent_to_track function in createsend

To help you get started, we’ve selected a few createsend examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github campaignmonitor / createsend-python / lib / createsend / transactional.py View on Github external
def classic_email_send(self, subject, from_address, to, consent_to_track, client_id=None, cc=None, bcc=None, html=None, text=None, attachments=None, track_opens=True, track_clicks=True, inline_css=True, group=None, add_recipients_to_list=None):
        """Sends a classic email."""
        validate_consent_to_track(consent_to_track)
        body = {
            "Subject": subject,
            "From": from_address,
            "To": to,
            "CC": cc,
            "BCC": bcc,
            "HTML": html,
            "Text": text,
            "Attachments": attachments,
            "TrackOpens": track_opens,
            "TrackClicks": track_clicks,
            "InlineCSS": inline_css,
            "Group": group,
            "AddRecipientsToList": add_recipients_to_list,
            "ConsentToTrack": consent_to_track,
        }
github campaignmonitor / createsend-python / lib / createsend / subscriber.py View on Github external
def add(self, list_id, email_address, name, custom_fields, resubscribe, consent_to_track, restart_subscription_based_autoresponders=False):
        """Adds a subscriber to a subscriber list."""
        validate_consent_to_track(consent_to_track)
        body = {
            "EmailAddress": email_address,
            "Name": name,
            "CustomFields": custom_fields,
            "Resubscribe": resubscribe,
            "ConsentToTrack": consent_to_track,
            "RestartSubscriptionBasedAutoresponders": restart_subscription_based_autoresponders}
        response = self._post("/subscribers/%s.json" %
                              list_id, json.dumps(body))
        return json_to_py(response)
github campaignmonitor / createsend-python / lib / createsend / transactional.py View on Github external
def smart_email_send(self, smart_email_id, to, consent_to_track, cc=None, bcc=None, attachments=None, data=None, add_recipients_to_list=None):
        """Sends the smart email."""
        validate_consent_to_track(consent_to_track)
        body = {
            "To": to,
            "CC": cc,
            "BCC": bcc,
            "Attachments": attachments,
            "Data": data,
            "AddRecipientsToList": add_recipients_to_list,
            "ConsentToTrack": consent_to_track,
        }
        response = self._post("/transactional/smartEmail/%s/send" %
                              smart_email_id, json.dumps(body))
        return json_to_py(response)
github campaignmonitor / createsend-python / lib / createsend / subscriber.py View on Github external
def update(self, new_email_address, name, custom_fields, resubscribe, consent_to_track, restart_subscription_based_autoresponders=False):
        """Updates any aspect of a subscriber, including email address, name, and
        custom field data if supplied."""
        validate_consent_to_track(consent_to_track)
        params = {"email": self.email_address}
        body = {
            "EmailAddress": new_email_address,
            "Name": name,
            "CustomFields": custom_fields,
            "Resubscribe": resubscribe,
            "ConsentToTrack": consent_to_track,
            "RestartSubscriptionBasedAutoresponders": restart_subscription_based_autoresponders}
        response = self._put("/subscribers/%s.json" % self.list_id,
                             body=json.dumps(body), params=params)
        # Update self.email_address, so this object can continue to be used
        # reliably
        self.email_address = new_email_address