def setUp(self): #ip = '192.168.56.101' # was '192.168.1.124' ip = '192.168.1.107' url = "%s/drupal7/sites/all/modules/civicrm/" % ip site_key = '371cfadc834d2784a35e4f4ab20c1316' api_key = 'b734df56706432bb514ed737465424c3' self.cc = CiviCRM(url, site_key, api_key, timeout=1, use_ssl=False) self.contact_id = 202 # id for a valid civicrm user self.contact_json = '''{ "address_id": "1", "country_id": "1228", "contact_id": "1", "id": "1", "world_region": "America South, Central, North and Caribbean", "city": "Portland", "preferred_mail_format": "Both", "display_name": "Test Test", "do_not_sms": "0", "email_id": "1", "organization_name": "org.org", "is_opt_out": "0", "do_not_email": "0", "do_not_mail": "0", "state_province_id": "1036", "email": "*****@*****.**", "worldregion_id": "2", "do_not_phone": "0", "is_deceased": "0", "state_province": "OR", "contact_type": "Individual", "contact_is_deleted": "0", "street_address": "PO Box 28228" }''' self.contacts = '{"values":[' + self.contact_json + ']}' self.results = """
def setUp(self): ip = IP_ADDR url = "%s/drupal7/sites/all/modules/civicrm/" % ip site_key = SITE_KEY api_key = API_KEY self.cc = CiviCRM(url, site_key, api_key, timeout=1, use_ssl=False) self.contact_id = 202 # id for a valid civicrm user
def setUp(self): ip = '192.168.56.101' # was '192.168.1.124' url = "%s/drupal7/sites/all/modules/civicrm/" % ip site_key = '371cfadc834d2784a35e4f4ab20c1316' api_key = 'b734df56706432bb514ed737465424c3' self.cc = CiviCRM(url, site_key, api_key, timeout=1, use_ssl=False) self.contact_id = 202 # id for a valid civicrm user
import pandas as pd import os from pythoncivicrm.pythoncivicrm import CiviCRM ''' About: CiviCRM is a CMS Framework for non-profit organization websites. This script leverages the CiviCRM API and was made to automate/update Contribution records. ''' # Establish Civi Connection url = 'https://dev.dccos.org/sites/all/modules/civicrm/extern/rest.php' # My CMS Site site_key = '####################' # this is private :P api_key = '#####################' # this is private :P civicrm = CiviCRM(url, site_key, api_key) # PART I ########################################################################################## # my contact id is 1799 # set working directory os.chdir('C:\\Users\\Matt Wilchek\\Documents') # read donation data donations_2015 = pd.read_csv('donations_2015.csv') donations_2015['contact_id'] = 0 search_results = civicrm.get('Contact', limit=5000) contacts = pd.DataFrame(search_results) search_results2 = civicrm.get('Contribution', limit=5000) contributions = pd.DataFrame(search_results2)