def __init__(self, folder='.', drush_path='drush', site='default', logfile=None): # init some attributes CiviCRM.__init__(self, logfile) self.folder = os.path.expanduser(folder) self.drush_path = os.path.expanduser(drush_path) self.site = 'default' self.non_parameters = set(['action', 'entity', 'key', 'api_key', 'sequential', 'json'])
def __init__(self, instance, logfile=None, options=dict()): CiviCRM.__init__(self, logfile) self.wrapped_instance = instance self.max_exec_time = 60 self.bridge = None self.calls = dict() self.call_base = random.randint(1000000,9999999) self.call_counter = 1 self.auth = None self.headers = {} if options.has_key('auth_user') and options.has_key('auth_pass'): from requests.auth import HTTPBasicAuth self.auth = HTTPBasicAuth(options['auth_user'], options['auth_pass'])
def __init__(self, url, site_key, user_key, logfile=None, options=dict()): # init some attributes CiviCRM.__init__(self, logfile) self.url = url self.site_key = site_key self.user_key = user_key self.auth = None self.forcePost = False self.headers = {} self.json_parameters = False if options.has_key('auth_user') and options.has_key('auth_pass'): from requests.auth import HTTPBasicAuth self.auth = HTTPBasicAuth(options['auth_user'], options['auth_pass']) # set rest url if self.url.endswith('extern/rest.php'): # in this case it's fine, this is the rest URL self.rest_url = self.url else: if self.url.endswith('/civicrm'): self.rest_url = self.url[:-8] + '/sites/all/modules/civicrm/extern/rest.php' else: self.rest_url = self.url + '/sites/all/modules/civicrm/extern/rest.php'