class JoinData(object): def __init__(self): self._sf = Salesforce() self._sf.load() """ Expects a dictionary with the platform user_id as keys each entry is dictionary. """ def join(self,data): for user_id,d in data.items(): d['company'] = self._sf.getField(user_id,'company') d['username'] = self._sf.getField(user_id,'username') uid = self._sf.getField(user_id,'user_id') users = [user_id] if uid is not None: users = { re.sub('[^0-9]','',x) for x in uid.split(',') } d['user_ids'] = users d['salesforce'] = self._sf.getLink(user_id) d['datasift'] = 'https://datasift.com/admin/user/%d/billing' % int(user_id) return data
class JoinData(object): def __init__(self): self._sf = Salesforce() self._sf.load() """ Expects a dictionary with the platform user_id as keys each entry is dictionary. """ def join(self, data): for user_id, d in data.items(): d['company'] = self._sf.getField(user_id, 'company') d['username'] = self._sf.getField(user_id, 'username') uid = self._sf.getField(user_id, 'user_id') users = [user_id] if uid is not None: users = {re.sub('[^0-9]', '', x) for x in uid.split(',')} d['user_ids'] = users d['salesforce'] = self._sf.getLink(user_id) d['datasift'] = 'https://datasift.com/admin/user/%d/billing' % int( user_id) return data
# coding:utf-8 import sys import argparse from salesforce import Salesforce from fake2csv import Csv import yaml parser = argparse.ArgumentParser(description='Output dammy data for any format and platform.') #parser.add_argument('command', nargs='?', type=str, help='') parser.add_argument('-r', '--rows', type=str, help='') parser.add_argument('-l', '--language', type=str, help='') parser.add_argument('-o', '--output', type=str, help='') args = parser.parse_args() config = yaml.load(open("config.yml", "r")) config["args"] = args if args.output == "salesforce" : plugin = Salesforce(config) else: plugin = Csv(config) plugin.load()
# coding:utf-8 import sys import argparse from salesforce import Salesforce from fake2csv import Csv import yaml parser = argparse.ArgumentParser( description='Output dammy data for any format and platform.') #parser.add_argument('command', nargs='?', type=str, help='') parser.add_argument('-r', '--rows', type=str, help='') parser.add_argument('-l', '--language', type=str, help='') parser.add_argument('-o', '--output', type=str, help='') args = parser.parse_args() config = yaml.load(open("config.yml", "r")) config["args"] = args if args.output == "salesforce": plugin = Salesforce(config) else: plugin = Csv(config) plugin.load()