How to use the createsend.CreateSend.api_key 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 philippbosch / django-campaignmonitor / campaignmonitor / models / campaigns.py View on Github external
def create_draft(self, preview_recipients=[]):
        CreateSend.api_key = settings.API_KEY
        campaign = CSCampaign()
        attrs = dict(
            client_id=settings.CLIENT_ID,
            subject=self.subject,
            name=self.name,
            from_name=self.from_name,
            from_email=self.from_email,
            reply_to=self.from_email, # TODO
            html_url=self.html_url,
            text_url=self.text_url,
            list_ids=self.list_ids,
            segment_ids=self.segment_ids,
        )
        try:
            campaign_id = campaign.create(**attrs)
            self.cm_id = campaign_id