from datetime import datetime, timedelta

import json
    
printout = True

creds_file = open('creds.txt', 'r')
access_token = creds_file.readline().replace('\n', '')
api_key = creds_file.readline().replace('\n', '')
api_url = creds_file.readline().replace('\n', '')

constantcontact = ConstantContact(api_key, access_token, api_url)

print '[test] get_campaigns'
response = constantcontact.get_campaigns()
if printout and response:
    print json.dumps(response, indent = 4, sort_keys = True)
    raw_input('press enter for next test')

campaign = response.get_item(0).get_id()

for c in response.get_set():
    if c.get_status() == 'SENT':
        sent_campaign = c
        break

print '[test] get_campaign'
response = constantcontact.get_campaign(campaign)
if printout and response:
    print json.dumps(response, indent = 4, sort_keys = True)
Esempio n. 2
0
from datetime import datetime, timedelta

import json

printout = True

creds_file = open('creds.txt', 'r')
access_token = creds_file.readline().replace('\n', '')
api_key = creds_file.readline().replace('\n', '')
api_url = creds_file.readline().replace('\n', '')

constantcontact = ConstantContact(api_key, access_token, api_url)

print '[test] get_campaigns'
response = constantcontact.get_campaigns()
if printout and response:
    print json.dumps(response, indent=4, sort_keys=True)
    raw_input('press enter for next test')

campaign = response.get_item(0).get_id()

for c in response.get_set():
    if c.get_status() == 'SENT':
        sent_campaign = c
        break

print '[test] get_campaign'
response = constantcontact.get_campaign(campaign)
if printout and response:
    print json.dumps(response, indent=4, sort_keys=True)