def test_cont_email_address(self):
        contact = Contact()
        email_address = Email_Address()

        email_address.set_email_address("*****@*****.**")

        self.assertEqual(contact.get_email_address(), None)

        contact.set_email_address(email_address)

        self.assertEqual(contact.get_email_address().get_email_address(), "*****@*****.**")
    def test_cont_email_address(self):
        contact = Contact()
        email_address = Email_Address()

        email_address.set_email_address('*****@*****.**')

        self.assertEqual(contact.get_email_address(), None)

        contact.set_email_address(email_address)

        self.assertEqual(contact.get_email_address().get_email_address(),
                         '*****@*****.**')
Esempio n. 3
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. 4
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. 5
0
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()

for l in contact_lists:
    if l.get_name().lower() == 'general interest':
        list_id = l.get_id()
        break

print '[test] post_contacts'
contact = Contact()
contact.add_list_id(list_id)
contact.add_list_id('1481737116')
contact.set_email_address(test_email)
response = constantcontact.post_contacts(contact)
if printout and response:
    print json.dumps(response, indent = 4, sort_keys = True)
    raw_input('press enter for next test')

print '[test] get_contact by email'
response = constantcontact.get_contacts(email = test_email)
if printout and response:
    print json.dumps(response, indent = 4, sort_keys = True)
    raw_input('press enter for next test')
contact = response['results'][0]
contact_id = contact.get_id()

print '[test] get_contact'
response = constantcontact.get_contact(contact_id)
Esempio n. 6
0
constantcontact = ConstantContact(api_key, access_token, api_url)

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

start_date = (datetime.now() + timedelta(hours=6)).replace(minute=0)
end_date = (datetime.now() + timedelta(days=5)).replace(minute=0)

verified_email_address = constantcontact.get_verified_email_addresses('CONFIRMED')[0]['email_address']

contact = Contact()
contact.set_email_address(verified_email_address)
contact.set_first_name('Bob')
contact.set_company_name('Justice League')
contact.set_work_phone('8675309')

event = Event()
event.set_end_date(end_date.isoformat())
event.set_name('Test event '+str(randint(1000000, 9999999)))
event.set_title('please ignore')
event.set_contact(contact)
event.set_location('THE SECRET MOONBASE')
event.set_time_zone_id('US/Eastern')
event.set_type('OTHER')
event.set_start_date(start_date.isoformat())

print '[test] post_events'
Esempio n. 7
0
import json
    
from random import randint

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)

contact1 = Contact()
contact1.set_email_address('*****@*****.**')
contact1.set_first_name('Albus')

contact2 = Contact()
contact2.set_email_address('*****@*****.**')
contact2.set_first_name('Severus')

import_data = []
import_data.append(contact1)
import_data.append(contact2)

contact_lists = constantcontact.get_lists()

for l in contact_lists:
    if l.get_name().lower() == 'general interest':
        general_interest = [l.get_id()]