Esempio n. 1
0
def cc_indiegogo_signup(request):
    if request.method == "POST":
        constantcontact = ConstantContact(
            settings.CONSTANT_CONTACT_API_KEY,
            settings.CONSTANT_CONTACT_ACCESS_TOKEN,
            settings.CONSTANT_CONTACT_API_URL)
        contact = Contact()
        contact.add_list_id(settings.CONSTANT_CONTACT_LIST_ID)
        contact.set_email_address(request.POST['email'])
        response = constantcontact.post_contacts(contact)

        if response.has_key('error_key'):
            return HttpResponse(response['error_key'])
        else:
            return HttpResponse('201')
Esempio n. 2
0
from constantcontact import ConstantContact, Contact
from random import randint

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)

test_email = 'test'+str(randint(1000000, 9999999))+'@example.com'

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

next_page = response.get_next_page()

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

contact_lists = constantcontact.get_lists()