Пример #1
0
    def __get_partner_client(self):
        wsdl_location = os.path.join(mm_util.WSDL_PATH, 'partner.xml')
        try:
            if os.path.exists(
                    os.path.join(config.connection.project.location, 'config',
                                 'partner.xml')):
                wsdl_location = os.path.join(
                    config.connection.project.location, 'config',
                    'partner.xml')
        except:
            pass

        return SforcePartnerClient(
            wsdl_location,
            apiVersion=mm_util.SFDC_API_VERSION,
            environment=self.org_type,
            sid=self.sid,
            metadata_server_url=self.metadata_server_url,
            server_url=self.endpoint)
Пример #2
0
    def __get_partner_client(self):
        if int(float(util.SFDC_API_VERSION)) >= 29:
            wsdl_location = os.path.join(util.WSDL_PATH, 'partner-29.xml')
        else:
            wsdl_location = os.path.join(util.WSDL_PATH, 'partner.xml')
        try:
            if os.path.exists(os.path.join(config.project.location,'config','partner.xml')):
                wsdl_location = os.path.join(config.project.location,'config','partner.xml')
        except:
            pass
        client = SforcePartnerClient(
            wsdl_location, 
            apiVersion=util.SFDC_API_VERSION, 
            environment=self.org_type, 
            sid=self.sid, 
            metadata_server_url=self.metadata_server_url, 
            server_url=self.endpoint)

        callOptions = client.generateHeader('CallOptions')
        callOptions.client = self.client_name
        client.setCallOptions(callOptions)
        return client
Пример #3
0
 def login(self, wsdl, username, password, token):
     self.client = SforcePartnerClient(wsdl)
     self.client.login(username, password, token)
Пример #4
0
 def connect2SForce(self):
     self.env.log.debug('--- Called connect2SForce: %s, %s, %s, %s' % \
       (self.username, self.password, self.sectoken, self.wsdlPath))
     self.sf = SforcePartnerClient(self.wsdlPath)
     self.sf.login(self.username, self.password, self.sectoken)
 def setUp(self):
     if self.h is None:
         self.h = SforcePartnerClient('../partner.wsdl.xml')
         self.h.login(test_config.USERNAME, test_config.PASSWORD,
                      test_config.TOKEN)
Пример #6
0
import os
import logging

from sforce.partner import SforcePartnerClient

import settings

from apicli import ClientCmdWrapper, run

logging.getLogger('suds').setLevel(logging.INFO)

SFPARTNER_WSDL = os.path.join(os.path.dirname(__file__), 'partnerwsdl.xml')
# XXX Slow?
SFPARTNER_CLIENT = SforcePartnerClient(SFPARTNER_WSDL)


class SalesforceSOAPClient(object):
    def __init__(self, username, password, token):
        self.username = username
        self.password = password
        self.token = token
        self.client = SFPARTNER_CLIENT

    def login(self):
        """ login to SFDC """
        self.client.login(self.username, self.password, self.token)

    def queryAll(self, object_name, fields=None, where=''):
        """ Query for object_name in SFDC """
        if fields is None:
            fields = []