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


Python xmlrpc_client.ServerProxy方法代碼示例

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


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

示例1: setUpClass

# 需要導入模塊: from six.moves import xmlrpc_client [as 別名]
# 或者: from six.moves.xmlrpc_client import ServerProxy [as 別名]
def setUpClass(self):
        import tests.data_test_webpage
        import httpbin

        self.httpbin_thread = utils.run_in_subprocess(httpbin.app.run, host='0.0.0.0', port=14887, passthrough_errors=False)
        self.httpbin = 'http://' + socket.gethostbyname(socket.gethostname()) + ':14887'

        self.inqueue = Queue(10)
        self.outqueue = Queue(10)
        self.fetcher = Fetcher(self.inqueue, self.outqueue)
        self.fetcher.splash_endpoint = 'http://127.0.0.1:8050/execute'
        self.rpc = xmlrpc_client.ServerProxy('http://localhost:%d' % 24444)
        self.xmlrpc_thread = utils.run_in_thread(self.fetcher.xmlrpc_run, port=24444)
        self.thread = utils.run_in_thread(self.fetcher.run)
        self.proxy_thread = subprocess.Popen(['pyproxy', '--username=binux', '--bind=0.0.0.0',
                                              '--password=123456', '--port=14830',
                                              '--debug'], close_fds=True)
        self.proxy = socket.gethostbyname(socket.gethostname()) + ':14830' 
開發者ID:binux,項目名稱:pyspider,代碼行數:20,代碼來源:test_fetcher.py

示例2: _connect

# 需要導入模塊: from six.moves import xmlrpc_client [as 別名]
# 或者: from six.moves.xmlrpc_client import ServerProxy [as 別名]
def _connect(self, config):
        server = config['sat_server']
        self.username = config['sat_username']
        self.password = config['sat_password']

        if not server.startswith("http://") and not server.startswith("https://"):
            server = "https://%s" % server
        if not server.endswith("XMLRPC"):
            server = "%s/XMLRPC" % server

        try:
            self.force_register = self.options.force_register
        except AttributeError:
            self.force_register = False

        self.logger.debug("Initializing satellite connection to %s", server)
        try:
            # We need two API endpoints: /XMLRPC and /rpc/api
            self.server_xmlrpc = xmlrpc_client.ServerProxy(server, verbose=0, transport=RequestsXmlrpcTransport(server))
            server_api = server.replace('/XMLRPC', '/rpc/api')
            self.server_rpcapi = xmlrpc_client.ServerProxy(server_api, verbose=0, transport=RequestsXmlrpcTransport(server_api))
        except Exception as e:
            self.logger.exception("Unable to connect to the Satellite server")
            raise SatelliteError("Unable to connect to the Satellite server: " % str(e))
        self.logger.debug("Initialized satellite connection") 
開發者ID:candlepin,項目名稱:virt-who,代碼行數:27,代碼來源:satellite.py

示例3: _getStringValue

# 需要導入模塊: from six.moves import xmlrpc_client [as 別名]
# 或者: from six.moves.xmlrpc_client import ServerProxy [as 別名]
def _getStringValue(val):
    try:
        if isinstance(val, xmlrpc_client.ServerProxy):
            rval = "<Server Proxy>"
        elif hasattr(val, 'asString'):
            rval = val.asString()
        elif inspect.isclass(val):
            rval = '<Class %s.%s>' % (val.__module__, val.__name__)
        elif not hasattr(val, '__str__'):
            if hasattr(val, '__class__'):
                rval = '<unprintable of class %s>' % val.__class__
            else:
                rval = '<unprintable>'
        else:
            rval = val
        return rval
    except Exception as e:
        try:
            return '<Exception occured while converting %s to string: %s' % (
                repr(val), e)
        except Exception as e:
            return '<Exception occured while converting to repr: %s' % (e,) 
開發者ID:sassoftware,項目名稱:epdb,代碼行數:24,代碼來源:epdb_stackutil.py

示例4: setUpClass

# 需要導入模塊: from six.moves import xmlrpc_client [as 別名]
# 或者: from six.moves.xmlrpc_client import ServerProxy [as 別名]
def setUpClass(self):
        shutil.rmtree('./data/tests', ignore_errors=True)
        os.makedirs('./data/tests')

        def get_taskdb():
            return taskdb.TaskDB(self.taskdb_path)
        self.taskdb = get_taskdb()

        def get_projectdb():
            return projectdb.ProjectDB(self.projectdb_path)
        self.projectdb = get_projectdb()

        def get_resultdb():
            return resultdb.ResultDB(self.resultdb_path)
        self.resultdb = get_resultdb()

        self.newtask_queue = Queue(10)
        self.status_queue = Queue(10)
        self.scheduler2fetcher = Queue(10)
        self.rpc = xmlrpc_client.ServerProxy('http://localhost:%d' % self.scheduler_xmlrpc_port)

        def run_scheduler():
            scheduler = Scheduler(taskdb=get_taskdb(), projectdb=get_projectdb(),
                                  newtask_queue=self.newtask_queue, status_queue=self.status_queue,
                                  out_queue=self.scheduler2fetcher, data_path="./data/tests/",
                                  resultdb=get_resultdb())
            scheduler.UPDATE_PROJECT_INTERVAL = 0.1
            scheduler.LOOP_INTERVAL = 0.1
            scheduler.INQUEUE_LIMIT = 10
            scheduler.DELETE_TIME = 0
            scheduler.DEFAULT_RETRY_DELAY = {'': 5}
            scheduler._last_tick = int(time.time())  # not dispatch cronjob
            self.xmlrpc_thread = run_in_thread(scheduler.xmlrpc_run, port=self.scheduler_xmlrpc_port)
            scheduler.run()

        self.process = run_in_thread(run_scheduler)
        time.sleep(1) 
開發者ID:binux,項目名稱:pyspider,代碼行數:39,代碼來源:test_scheduler.py

示例5: test_xmlrpc_server

# 需要導入模塊: from six.moves import xmlrpc_client [as 別名]
# 或者: from six.moves.xmlrpc_client import ServerProxy [as 別名]
def test_xmlrpc_server(self, uri='http://127.0.0.1:3423'):
        from six.moves.xmlrpc_client import ServerProxy
        
        client = ServerProxy(uri)
        
        assert client.test_1() == 'test_1'
        assert client.test_3({'asdf':4}) == {'asdf':4} 
開發者ID:binux,項目名稱:pyspider,代碼行數:9,代碼來源:test_xmlrpc.py

示例6: connect_rpc

# 需要導入模塊: from six.moves import xmlrpc_client [as 別名]
# 或者: from six.moves.xmlrpc_client import ServerProxy [as 別名]
def connect_rpc(ctx, param, value):
    if not value:
        return
    try:
        from six.moves import xmlrpc_client
    except ImportError:
        import xmlrpclib as xmlrpc_client
    return xmlrpc_client.ServerProxy(value, allow_none=True) 
開發者ID:binux,項目名稱:pyspider,代碼行數:10,代碼來源:run.py

示例7: xml_pypi_server

# 需要導入模塊: from six.moves import xmlrpc_client [as 別名]
# 或者: from six.moves.xmlrpc_client import ServerProxy [as 別名]
def xml_pypi_server(server):
    transport = xmlrpc_client.Transport()
    client = xmlrpc_client.ServerProxy(server, transport)
    try:
        yield client
    finally:
        transport.close() 
開發者ID:pypa,項目名稱:pipenv,代碼行數:9,代碼來源:app.py

示例8: __init__

# 需要導入模塊: from six.moves import xmlrpc_client [as 別名]
# 或者: from six.moves.xmlrpc_client import ServerProxy [as 別名]
def __init__(self):
        self.server = xmlrpc_client.ServerProxy("http://127.0.0.1:12400", allow_none=True)
        self.last_update = None 
開發者ID:wolfmanstout,項目名稱:dragonfly-commands,代碼行數:5,代碼來源:_linux_utils.py

示例9: __init__

# 需要導入模塊: from six.moves import xmlrpc_client [as 別名]
# 或者: from six.moves.xmlrpc_client import ServerProxy [as 別名]
def __init__(self, uri, transport=None, encoding=None, verbose=0,
                 allow_none=1):
        xmlrpc_client.ServerProxy.__init__(self, uri, transport, encoding,
                                       verbose, allow_none)
        self.transport = transport
        self._session = None
        self.last_login_method = None
        self.last_login_params = None
        self.API_version = API_VERSION_1_1 
開發者ID:candlepin,項目名稱:virt-who,代碼行數:11,代碼來源:XenAPI.py

示例10: __getattr__

# 需要導入模塊: from six.moves import xmlrpc_client [as 別名]
# 或者: from six.moves.xmlrpc_client import ServerProxy [as 別名]
def __getattr__(self, name):
        if name == 'handle':
            return self._session
        elif name == 'xenapi':
            return _Dispatcher(self.API_version, self.xenapi_request, None)
        elif name.startswith('login') or name.startswith('slave_local'):
            return lambda *params: self._login(name, params)
        else:
            return xmlrpc_client.ServerProxy.__getattr__(self, name) 
開發者ID:candlepin,項目名稱:virt-who,代碼行數:11,代碼來源:XenAPI.py

示例11: connect

# 需要導入模塊: from six.moves import xmlrpc_client [as 別名]
# 或者: from six.moves.xmlrpc_client import ServerProxy [as 別名]
def connect(url, encoding='UTF-8', use_datetime=True, ssl_verify=True):
    # pylint: disable=protected-access
    context = None if ssl_verify else ssl._create_unverified_context()
    return xmlrpc.ServerProxy(url, encoding=encoding, use_datetime=use_datetime, context=context) 
開發者ID:tracboat,項目名稱:tracboat,代碼行數:6,代碼來源:trac.py

示例12: __init__

# 需要導入模塊: from six.moves import xmlrpc_client [as 別名]
# 或者: from six.moves.xmlrpc_client import ServerProxy [as 別名]
def __init__(self, uri, timeout=DEFAULT_TIMEOUT, *args, **kwargs):
        transport = _TimeoutTransport(timeout=timeout, *args, **kwargs)
        kwargs['transport'] = transport
        xmlrpclib.ServerProxy.__init__(self, uri, *args, **kwargs) 
開發者ID:katyukha,項目名稱:odoo-rpc-client,代碼行數:6,代碼來源:xmlrpc.py

示例13: __getattr__

# 需要導入模塊: from six.moves import xmlrpc_client [as 別名]
# 或者: from six.moves.xmlrpc_client import ServerProxy [as 別名]
def __getattr__(self, name):
        res = xmlrpclib.ServerProxy.__getattr__(self, name)
        if isinstance(res, xmlrpclib._Method):
            res = XMLRPCMethod(res)
        return res 
開發者ID:katyukha,項目名稱:odoo-rpc-client,代碼行數:7,代碼來源:xmlrpc.py

示例14: _SearchCommand_search

# 需要導入模塊: from six.moves import xmlrpc_client [as 別名]
# 或者: from six.moves.xmlrpc_client import ServerProxy [as 別名]
def _SearchCommand_search(cmd, _query, options):
    from six.moves import xmlrpc_client
    from pip._internal.download import PipXmlrpcTransport

    index_url = options.index
    with cmd._build_session(options) as session:
        transport = PipXmlrpcTransport(index_url, session)
        pypi = xmlrpc_client.ServerProxy(index_url, transport)
        return pypi.search(cmd._spec, cmd._operator) 
開發者ID:guildai,項目名稱:guildai,代碼行數:11,代碼來源:pip_util.py

示例15: __init__

# 需要導入模塊: from six.moves import xmlrpc_client [as 別名]
# 或者: from six.moves.xmlrpc_client import ServerProxy [as 別名]
def __init__(self, username=None, password=None):
        self.server = ServerProxy('https://api.opensubtitles.org/xml-rpc', TimeoutSafeTransport(10))
        if any((username, password)) and not all((username, password)):
            raise ConfigurationError('Username and password must be specified')
        # None values not allowed for logging in, so replace it by ''
        self.username = username or ''
        self.password = password or ''
        self.token = None 
開發者ID:morpheus65535,項目名稱:bazarr,代碼行數:10,代碼來源:opensubtitles.py


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