当前位置: 首页>>代码示例>>Python>>正文


Python xmlrpclib.Transport类代码示例

本文整理汇总了Python中xmlrpclib.Transport的典型用法代码示例。如果您正苦于以下问题:Python Transport类的具体用法?Python Transport怎么用?Python Transport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Transport类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, username, password, verbose=0, use_datetime=False,
                 https_handler=None):
        Transport.__init__(self, use_datetime=False)
        self._username = username
        self._password = password
        self._use_datetime = use_datetime
        self.verbose = verbose
        self._username = username
        self._password = password

        self._handlers = []

        if self._username and self._password:
            self._passmgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
            self._auth_handler = urllib2.HTTPDigestAuthHandler(self._passmgr)
        else:
            self._auth_handler = None
            self._passmgr = None

        if https_handler:
            self._handlers.append(https_handler)
            self._scheme = 'https'
        else:
            self._scheme = 'http'

        if self._auth_handler:
            self._handlers.append(self._auth_handler)
开发者ID:BenMayo,项目名称:exetest8,代码行数:27,代码来源:connection.py

示例2: __init__

    def __init__(self, socket):
        Transport.__init__(self)

        def connect(self):
            self.sock = socket

        connection = httplib.HTTPConnection
        connection.connect = connect
开发者ID:carriercomm,项目名称:vdsm,代码行数:8,代码来源:jsonRpcHelper.py

示例3: __init__

 def __init__(self, endpoint, cookie_jar=None):
     Transport.__init__(self, use_datetime=True)
     self.scheme, self.host = urlparse(endpoint)[:2]
     assert self.scheme in ('http', 'https'), (
         "Unsupported URL scheme: %s" % self.scheme)
     self.cookie_processor = HTTPCookieProcessor(cookie_jar)
     self.redirect_handler = XMLRPCRedirectHandler()
     self.opener = build_opener(
         self.cookie_processor, self.redirect_handler)
     self.timeout = config.checkwatches.default_socket_timeout
开发者ID:pombreda,项目名称:UnnaturalCodeFork,代码行数:10,代码来源:xmlrpc.py

示例4: __init__

    def __init__(self, ca_certs=None, keyfile=None, certfile=None, cert_reqs=None,
                 ssl_version=None, timeout=None, strict=None):

        self.ca_certs = ca_certs
        self.keyfile = keyfile
        self.certfile = certfile
        self.cert_reqs = cert_reqs
        self.ssl_version = ssl_version
        self.timeout = timeout
        self.strict = strict

        Transport.__init__(self)
开发者ID:Cophy08,项目名称:spring-python,代码行数:12,代码来源:xmlrpc.py

示例5: get_host_info

    def get_host_info(self, host):
        host, extra_headers, x509 = Transport.get_host_info(self,host)
        if extra_headers == None:
                extra_headers = []

        extra_headers.append( ( 'Connection', 'keep-alive' ))

        return host, extra_headers, x509
开发者ID:ShantiSR,项目名称:openerp-addons,代码行数:8,代码来源:test_davclient.py

示例6: __init__

    def __init__(self, key_file, cert_file):
        Transport.__init__(self)
        self.key_file = key_file
        self.cert_file = cert_file

        # in pyth version 2.7 upwards, the xmlrpclib.Transport library seems
        # to re-use connections or for some other reason likes to store the
        # connection in self._connection.  This version is designed to work
        # with both without clobbering either.  This is potentially brittle
        # code, so we check the python version so we can revise things if
        # neccessary

        if sys.version_info[0] == 2 and sys.version_info[1] not in (6,7):
            sys.stderr.write("SaferTransport implementation has not been " + \
                    "checked in this version.  Please check to make sure " + \
                    "it still works\n")

        self._connection = (None, None)
开发者ID:gmurdocca,项目名称:fcombine,代码行数:18,代码来源:XMLRPCClient.py

示例7: __init__

    def __init__(self, realm, url, username=None, password=None, **kwds):
        """
        Initialization.

        EXAMPLES::

            sage: from trac_interface import REALM, TRAC_SERVER_URI, DigestTransport
            sage: type(DigestTransport(REALM, TRAC_SERVER_URI+"/xmlrpc"))
            trac_interface.DigestTransport

        """
        Transport.__init__(self, **kwds)

        authhandler = urllib2.HTTPDigestAuthHandler()
        if username and password:
            authhandler.add_password(realm, url, username, password)

        self.opener = urllib2.build_opener(authhandler)
开发者ID:digideskio,项目名称:sage-workflow,代码行数:18,代码来源:trac_interface.py

示例8: getparser

    def getparser(self):
        parser, unmarshaller = Transport.getparser(self)
        dispatch = unmarshaller.dispatch.copy()
        unmarshaller.dispatch = dispatch
        # Now we can add custom types
        dispatch["ex:nil"] = dispatch["nil"]
        dispatch["ex:i2"] = dispatch["int"]
        dispatch["ex:i4"] = dispatch["int"]
        dispatch["ex:i8"] = dispatch["int"]

        return parser, unmarshaller
开发者ID:DaltenMedia,项目名称:rmix_api_interactive_console,代码行数:11,代码来源:console.py

示例9: xmlrpc_connection

class xmlrpc_connection(object):
    def __init__(self, host=None, port=8182):
        if host is None:
            host = gethostname()
        self.host = "%s:%s" % (host, port)
        self.transport = Transport()

    def remote(self, method, params=()):
        """ Invoke the server with the given method name and parameters.
            The return value is always a tuple. """
        return self.transport.request(self.host, "/RPC2", dumps(params, method))
开发者ID:badboywj,项目名称:python_practice,代码行数:11,代码来源:cb2_15_3_sol_2.py

示例10: __init__

	def __init__(self, uri, cookiejar=None, use_datetime=0):
		Transport.__init__(self, use_datetime=use_datetime)

		self.opener = build_opener()

		# Parse auth (user:passwd) from the uri
		urltype, rest = splittype(uri)
		host, rest = splithost(rest)
		auth, host = splituser(host)
		self.uri = urltype + '://' + host + rest

		# Handle HTTP Basic authentication
		if auth is not None:
			user, passwd = splitpasswd(auth)
			passwdmgr = HTTPPasswordMgrWithDefaultRealm()
			passwdmgr.add_password(realm=None, uri=self.uri, user=user, passwd=passwd)
			authhandler = HTTPBasicAuthHandler(passwdmgr)
			self.opener.add_handler(authhandler)

		# Handle HTTP Cookies
		if cookiejar is not None:
			self.opener.add_handler(HTTPCookieProcessor(cookiejar))
开发者ID:Xarthisius,项目名称:pybugz,代码行数:22,代码来源:bugzilla.py

示例11: make_connection

 def make_connection(self, host):
     self.realhost = host
     proxies = urllib.getproxies()
     proxyurl = None
     if 'http' in proxies:
         proxyurl = proxies['http']
     elif 'all' in proxies:
         proxyurl = proxies['all']
     if proxyurl:
         urltype, proxyhost = urllib.splittype(proxyurl)
         host, selector = urllib.splithost(proxyhost)
         h = httplib.HTTP(host)
         self.proxy_is_used = True
         return h
     else:
         self.proxy_is_used = False
         return Transport.make_connection(self, host)
开发者ID:BackupTheBerlios,项目名称:griffith-svn,代码行数:17,代码来源:PluginMovieMovieMeter.py

示例12: get_host_info

    def get_host_info(self, host):
        (host, extra_headers, x509) = Transport.get_host_info(self, host)

        try:
            lang = locale.setlocale(locale.LC_ALL, '').split('.')[0].lower()
        except locale.Error:
            # fallback to default locale
            lang = 'en_us'

        if not isinstance(extra_headers, list):
            extra_headers = []

        extra_headers.append(
            ('Accept-Language', lang.replace('_', '-'))
        )
        extra_headers.append(
            ('Referer', 'https://%s/ipa/xml' % str(host))
        )

        return (host, extra_headers, x509)
开发者ID:jtux270,项目名称:translate,代码行数:20,代码来源:rpc.py

示例13: __init__

class xmlrpc_connection:
    """The xmlrpc_connection class tests the xmlrpc_server.  You must 
    download and install the medusa and xmlrpclib libraries to run 
    this code:  http://www.nightmare.com  http://www.pythonware.com"""

    def __init__(self, host=None, port=8182):
        if host is None:
            host = gethostname()
        self.host = "%s:%s" % (host, port)
        self.transport = Transport()

    def remote(self, method, params=()):
        """remote invokes the server with the method name and an 
        optional set of parameters.  The return value is always a
        tuple."""

        response = self.transport.request(self.host, 
                                          '/RPC2',
                                          dumps(params, method))
        return response
开发者ID:bhramoss,项目名称:code,代码行数:20,代码来源:recipe-52226.py

示例14: request

 def request(self, host, handler, request_body, verbose=0):
     """Make the request but using the with_timeout decorator."""
     return Transport.request(
         self, host, handler, request_body, verbose)
开发者ID:pombreda,项目名称:UnnaturalCodeFork,代码行数:4,代码来源:timeout.py

示例15: __init__

 def __init__(self, *args, **kwargs):
     Transport.__init__(self, *args, **kwargs)
     self.client = Client()
开发者ID:anujag,项目名称:django-gstudio,代码行数:3,代码来源:utils.py


注:本文中的xmlrpclib.Transport类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。