當前位置: 首頁>>代碼示例>>Python>>正文


Python transports.Transport方法代碼示例

本文整理匯總了Python中zeep.transports.Transport方法的典型用法代碼示例。如果您正苦於以下問題:Python transports.Transport方法的具體用法?Python transports.Transport怎麽用?Python transports.Transport使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在zeep.transports的用法示例。


在下文中一共展示了transports.Transport方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from zeep import transports [as 別名]
# 或者: from zeep.transports import Transport [as 別名]
def __init__(self, hostname=None, username=None, password=None):
        """
        :param hostname:
            Checkmarx hostname
        :param username:
            Checkmarx username
        :param password:
            Checkmarx password
        """
        self.logger = configure_logging(logging.getLogger(__name__))
        self.hostname = hostname
        self.username = username
        self.password = password
        self.resolver_url = "%s/cxwebinterface/cxwsresolver.asmx?wsdl" % self.hostname
        session = Session()
        session.verify = False
        self.transport = Transport(session=session)
        try:
            self._resolver_client = Client(self.resolver_url, transport=self.transport)
        except Exception as error:
            self.logger.error("Checkmarx connection failed: {error}".format(error=error))
            raise ConnectionError(f"Checkmarx connection failed. Wrong or inaccessible hostname: {hostname}") from None
        self.session_id = None
        self.clients = {} 
開發者ID:dowjones,項目名稱:reapsaw,代碼行數:26,代碼來源:CheckmarxConnection.py

示例2: __init__

# 需要導入模塊: from zeep import transports [as 別名]
# 或者: from zeep.transports import Transport [as 別名]
def __init__(self, wsdl, settings):
        session = Session()
        transport = Transport(session=session, cache=ZeepCache())
        session.auth = HTTPBasicAuth(settings.get('username'), settings.get('password'))
        self.client = Client(wsdl, transport=transport)
        self.factory = self.client.type_factory('ns0') 
開發者ID:indico,項目名稱:indico-plugins,代碼行數:8,代碼來源:client.py

示例3: _generate_transport

# 需要導入模塊: from zeep import transports [as 別名]
# 或者: from zeep.transports import Transport [as 別名]
def _generate_transport(self) -> zeep.transports.Transport:
        return NetSuiteTransport(
            self._generate_wsdl_url(), session=self.session, cache=self.cache,
        ) 
開發者ID:jmagnusson,項目名稱:netsuite,代碼行數:6,代碼來源:client.py

示例4: get_soap_client

# 需要導入模塊: from zeep import transports [as 別名]
# 或者: from zeep.transports import Transport [as 別名]
def get_soap_client(wsdlurl, timeout=30):  # pragma: no cover (not part of normal test suite)
    """Get a SOAP client for performing requests. The client is cached. The
    timeout is in seconds."""
    # this function isn't automatically tested because the functions using
    # it are not automatically tested
    if (wsdlurl, timeout) not in _soap_clients:
        # try zeep first
        try:
            from zeep.transports import Transport
            transport = Transport(timeout=timeout)
            from zeep import CachingClient
            client = CachingClient(wsdlurl, transport=transport).service
        except ImportError:
            # fall back to non-caching zeep client
            try:
                from zeep import Client
                client = Client(wsdlurl, transport=transport).service
            except ImportError:
                # other implementations require passing the proxy config
                try:
                    from urllib import getproxies
                except ImportError:
                    from urllib.request import getproxies
                # fall back to suds
                try:
                    from suds.client import Client
                    client = Client(
                        wsdlurl, proxy=getproxies(), timeout=timeout).service
                except ImportError:
                    # use pysimplesoap as last resort
                    try:
                        from pysimplesoap.client import SoapClient
                        client = SoapClient(
                            wsdl=wsdlurl, proxy=getproxies(), timeout=timeout)
                    except ImportError:
                        raise ImportError(
                            'No SOAP library (such as zeep) found')
        _soap_clients[(wsdlurl, timeout)] = client
    return _soap_clients[(wsdlurl, timeout)] 
開發者ID:guohuadeng,項目名稱:odoo13-x64,代碼行數:41,代碼來源:util.py

示例5: __init__

# 需要導入模塊: from zeep import transports [as 別名]
# 或者: from zeep.transports import Transport [as 別名]
def __init__(self, account=None, caching=True, caching_timeout=2592000):
        """
        Initialize the Zeep SOAP client, parse the xsd specifications
        of Netsuite and store the complex types as attributes of this
        instance.

        :param str account_id: Account ID to connect to
        :param str caching: If caching = 'sqlite', setup Sqlite caching
        :param int caching_timeout: Timeout in seconds for caching.
                            If None, defaults to 30 days
        """
        self.logger = logging.getLogger(self.__class__.__name__)
        assert account, 'Invalid account'
        assert '-' not in account, 'Account cannot have hyphens, it is likely an underscore'
        self._account = account

        self._wsdl_url = self.WSDL_URL_TEMPLATE.format(account=account.replace('_', '-'))
        self._datacenter_url = self.DATACENTER_URL_TEMPLATE.format(account=account.replace('_', '-'))

        if caching:
            path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'cache.db')
            timeout = caching_timeout
            cache = SqliteCache(path=path, timeout=timeout)
            transport = Transport(cache=cache)
        else:
            transport = None

        # Initialize the Zeep Client
        self._client = Client(self._wsdl_url, transport=transport)

        # default service points to wrong data center. need to create a new service proxy and replace the default one
        self._service_proxy = self._client.create_service('{urn:platform_2019_1.webservices.netsuite.com}NetSuiteBinding', self._datacenter_url)

        # Parse all complex types specified in :const:`~netsuitesdk.netsuite_types.COMPLEX_TYPES`
        # and store them as attributes of this instance. Same for simple types.
        self._namespaces = {}
        self._init_complex_types()
        self._init_simple_types()

        self._app_info = None
        self._is_authenticated = False
        self.set_search_preferences() 
開發者ID:fylein,項目名稱:netsuite-sdk-py,代碼行數:44,代碼來源:client.py


注:本文中的zeep.transports.Transport方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。