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
    }
    from time import time
    time2 = time()
    print ac.api('campaign/create', campaign)
    print 'diff2 = %.5f seconds' % (time() - time2)

    ## delete
##    print ac.api('campaign/delete?id=12')

## delete_list
##    print ac.api('campaign/delete_list?ids=1,2')

## list
##    print ac.api('campaign/list?ids=3,4')

## paginator
##    print ac.api('campaign/paginator?sort=&offset=0&limit=20&filter=0&public=0')

## report_bounce_list
    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
    }
    from time import time
    time2 = time()
    print ac.api('campaign/create', campaign)
    print 'diff2 = %.5f seconds' %(time() - time2)
    

    ## delete
##    print ac.api('campaign/delete?id=12')

    ## delete_list
##    print ac.api('campaign/delete_list?ids=1,2')

    ## list
##    print ac.api('campaign/list?ids=3,4')

    ## paginator
##    print ac.api('campaign/paginator?sort=&offset=0&limit=20&filter=0&public=0')
        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'
        
    }
    #print ac.api('branding/edit', branding)
    
    ## view
    print ac.api('branding/view')
Beispiel #4
0
        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'
    }
    #print ac.api('branding/edit', branding)

    ## view
    print ac.api('branding/view')