def send(self, params, post_data={}):
        request_url = '%s&api_action=campaign_send&api_output=%s&%s' % (
            self.url, self.output, params)
        response = json.loads(urllib2.urlopen(request_url).read())
        return response

    def status(self, params, post_data={}):
        request_url = '%s&api_action=campaign_status&api_output=%s&%s' % (
            self.url, self.output, params)
        response = json.loads(urllib2.urlopen(request_url).read())
        return response


if __name__ == '__main__':
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)

    ## create
    sdate = datetime.datetime.now() + datetime.timedelta(hours=0, minutes=2)
    campaign = {
        'type': 'single',
        'name': 'testActiveCampaign: %s' % datetime.datetime.now(),
        'sdate': time.strftime('%Y-%m-%d %H:%M:%S', sdate.timetuple()),
        'status': 1,
        'public': 1,
        'tracklinks': 'all',
        'trackreads': 1,
        'htmlunsub': 1,
        'p[1]': 1,
        'm[35]': 100
    }
 def __init__(self, url, api_key):
     self.url = url
     self.api_key = api_key
     ActiveCampaign.__init__(self, url, api_key)
 def __init__(self, url, api_key):
     self.url = url
     self.api_key = api_key
     ActiveCampaign.__init__(self, url, api_key)
Exemple #4
0
        response = json.loads(urllib2.urlopen(request_url).read())
        return response

    def template_view(self, params, post_data = {}):
        request_url = '%s&api_action=message_template_view&api_output=%s&%s' % (self.url, self.output, params)
        response = json.loads(urllib2.urlopen(request_url).read())
        return response

    def view(self, params, post_data = {}):
        request_url = '%s&api_action=message_view&api_output=%s&%s' % (self.url, self.output, params)
        response = json.loads(urllib2.urlopen(request_url).read())
        return response


if __name__ == '__main__':
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL,  ACTIVECAMPAIGN_API_KEY)

    ## add
##    message = {
##        'format': 'mime',
##        'subject': 'Fetch at send: %s' % datetime.datetime.now(),
##        'fromemail': '*****@*****.**',
##        'fromname': 'John Smith',
##        'reply2': '*****@*****.**',
##        'priority': 3,
##        'charset': 'utf-8',
##        'encoding': 'quoted-printable',
##        'htmlconstructor': 'external',
##        'htmlfetch': 'http://example.com',
##        'htmlfetchwhen': 'send',
##        'textconstructor': 'external',
        ActiveCampaign.__init__(self, url, api_key)

    def edit(self, params, post_data):
        request_url = '%s&api_action=branding_edit&api_output=%s' % (self.url, self.output)
        post_data = urllib.urlencode(post_data)
        req = urllib2.Request(request_url, post_data)
        response = json.loads(urllib2.urlopen(req).read())
        return response
        
    def view(self, params, post_data):
        request_url = '%s&api_action=branding_view&api_output=%s' % (self.url, self.output)
        response = json.loads(urllib2.urlopen(request_url).read())
        return response
        
if __name__ == '__main__':
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL,  ACTIVECAMPAIGN_API_KEY)
    
    ## edit
    branding = {
        'id' : 1,
        'branding_url' : 'http://www.example.com/logo.png',
        'copyright' : 'off',
        'demo' : 'on',
        'footer_html' : 'html',
        'footer_html_valueEditor' : '',
        'groupid' :  3,
        'header_html' : 'html',
        'header_html_valueEditor' : '',
        'site_name' : 'Adulmec.ro',
        'logo_source' : 'url'
        
        request_url = '%s&api_action=campaign_report_unsubscription_totals&api_output=%s&%s' % (self.url, self.output, params)
        response = json.loads(urllib2.urlopen(request_url).read())
        return response

    def send(self, params, post_data = {}):
        request_url = '%s&api_action=campaign_send&api_output=%s&%s' % (self.url, self.output, params)
        response = json.loads(urllib2.urlopen(request_url).read())
        return response

    def status(self, params, post_data = {}):
        request_url = '%s&api_action=campaign_status&api_output=%s&%s' % (self.url, self.output, params)
        response = json.loads(urllib2.urlopen(request_url).read())
        return response
    
if __name__ == '__main__':
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL,  ACTIVECAMPAIGN_API_KEY)

    ## create
    sdate = datetime.datetime.now() + datetime.timedelta(hours = 0, minutes = 2)
    campaign = {
        'type': 'single',
        'name': 'testActiveCampaign: %s' % datetime.datetime.now(),
        'sdate': time.strftime('%Y-%m-%d %H:%M:%S', sdate.timetuple()),
        'status': 1,
        'public': 1,
        'tracklinks': 'all',
        'trackreads': 1,
        'htmlunsub': 1,
        'p[1]': 1,
        'm[35]': 100
    }
Exemple #7
0
        request_url = '%s&api_action=branding_edit&api_output=%s' % (
            self.url, self.output)
        post_data = urllib.urlencode(post_data)
        req = urllib2.Request(request_url, post_data)
        response = json.loads(urllib2.urlopen(req).read())
        return response

    def view(self, params, post_data):
        request_url = '%s&api_action=branding_view&api_output=%s' % (
            self.url, self.output)
        response = json.loads(urllib2.urlopen(request_url).read())
        return response


if __name__ == '__main__':
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)

    ## edit
    branding = {
        'id': 1,
        'branding_url': 'http://www.example.com/logo.png',
        'copyright': 'off',
        'demo': 'on',
        'footer_html': 'html',
        'footer_html_valueEditor': '',
        'groupid': 3,
        'header_html': 'html',
        'header_html_valueEditor': '',
        'site_name': 'Adulmec.ro',
        'logo_source': 'url'
    }