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


Python xmlrpclib.Server方法代码示例

本文整理汇总了Python中xmlrpclib.Server方法的典型用法代码示例。如果您正苦于以下问题:Python xmlrpclib.Server方法的具体用法?Python xmlrpclib.Server怎么用?Python xmlrpclib.Server使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xmlrpclib的用法示例。


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

示例1: __connect

# 需要导入模块: import xmlrpclib [as 别名]
# 或者: from xmlrpclib import Server [as 别名]
def __connect(self):
        """
        This function establishes a connection to Spacewalk.
        """
        #set api session and key
        try:
            self.api_session = Server(self.url)
            self.api_key = self.api_session.auth.login(self.username, self.password)
        except Fault as err:
            if err.faultCode == 2950:
                raise InvalidCredentialsException(
                    "Wrong credentials supplied: '%s'", err.faultString
                )
            else:
                raise SessionException(
                    "Generic remote communication error: '%s'", err.faultString
                ) 
开发者ID:stdevel,项目名称:katprep,代码行数:19,代码来源:SpacewalkAPIClient.py

示例2: connect_server

# 需要导入模块: import xmlrpclib [as 别名]
# 或者: from xmlrpclib import Server [as 别名]
def connect_server(self):
        protocol = ["http", "https"][self.ssl]
        self.url = "%s://%s:%d" % (protocol, self.host, self.port)
        print self.url
        self.connection = xmlrpclib.Server(self.url)
        self.connection_events = xmlrpclib.Server(self.url)
        try:
            self.session = self.connection.session.login_with_password(
                self.user, self.password)
            if self.session['Status'] == "Success":
                self.is_connected = True
                self.session_uuid = self.session['Value']
                self.session_events = \
                    self.connection_events.session.login_with_password(
                        self.user, self.password)
                self.session_events_uuid = self.session_events['Value']
                self.connection_events.event.register(
                    self.session_events_uuid, ["*"])
                # tell the controller that we've finished
                self.emit("connect-success")
            else:
                self.emit("connect-failure",
                          self.session['ErrorDescription'][2])
        except:
            self.emit("connect-failure", sys.exc_info()[1]) 
开发者ID:OpenXenManager,项目名称:openxenmanager,代码行数:27,代码来源:oxcSERVER_addserver.py

示例3: getXmlrpcClient

# 需要导入模块: import xmlrpclib [as 别名]
# 或者: from xmlrpclib import Server [as 别名]
def getXmlrpcClient(server_uri, auth = ()):
    """ this will return an xmlrpc client which supports
    basic authentication/authentication through cookies 
    """

    trans = CookieAuthXMLRPCTransport()
    if auth!= ():
        trans.credentials = auth
    client = xmlrpclib.Server(server_uri, transport=trans, verbose=False)
    
    return client 
开发者ID:ActiveState,项目名称:code,代码行数:13,代码来源:recipe-501148.py

示例4: check_process_state

# 需要导入模块: import xmlrpclib [as 别名]
# 或者: from xmlrpclib import Server [as 别名]
def check_process_state(process_name, state='RUNNING'):
    global wait_3
    if wait_3:
        time.sleep(3)
        wait_3 = False
    server = xmlrpclib.Server('http://localhost:9001/RPC2')
    try:
        response = server.supervisor.getProcessInfo(process_name)['statename'] == state
    except socket.error:
        response = None
    return response 
开发者ID:nasa-jpl-memex,项目名称:memex-explorer,代码行数:13,代码来源:supervisor_services.py

示例5: __enter__

# 需要导入模块: import xmlrpclib [as 别名]
# 或者: from xmlrpclib import Server [as 别名]
def __enter__(self):
        try:
            if self.__timeout:
                self.__prevDefaultTimeout = socket.getdefaulttimeout()
                socket.setdefaulttimeout(self.__timeout)
            proxy = xmlrpclib.Server(self.__url, allow_none=True)

        except Exception as ex:
            raise Exception("Unable create XMLRPC-proxy for url '%s': %s" % (self.__url, ex))

        return proxy 
开发者ID:ip-tools,项目名称:patzilla,代码行数:13,代码来源:xmlrpclib.py

示例6: __init__

# 需要导入模块: import xmlrpclib [as 别名]
# 或者: from xmlrpclib import Server [as 别名]
def __init__(self, base_dir=_DEF_BASE_DIR,
                 ip_address=_DEF_COBBLER_IP,
                 port=_DEF_COBBLER_PORT,
                 username=_DEF_USERNAME,
                 password=_DEF_PASSWORD):

        self._smgr_log = ServerMgrlogger()
        self._smgr_log.log(self._smgr_log.DEBUG, "ServerMgrCobbler Init")


        # Store the passed in values
        self._cobbler_ip = ip_address
        self._cobbler_port = port
        self._cobbler_username = username
        self._cobbler_password = password
        try:
            if self._cobbler_port:
                self._server = xmlrpclib.Server(
                    "http://" +
                    self._cobbler_ip + ":" +
                    self._cobbler_port + "/cobbler_api")
            else:
                self._server = xmlrpclib.Server(
                    "http://" +
                    self._cobbler_ip + "/cobbler_api")
            self._token = self._server.login(self._cobbler_username,
                                             self._cobbler_password)
        except subprocess.CalledProcessError as e:
            msg = ("Cobbler Init: error %d when executing"
                   "\"%s\"" %(e.returncode, e.cmd))
            self.log_and_raise_exception(msg, ERR_OPR_ERROR)
        except Exception as e:
            raise e
    # End of __init__ 
开发者ID:Juniper,项目名称:contrail-server-manager,代码行数:36,代码来源:server_mgr_cobbler.py

示例7: start

# 需要导入模块: import xmlrpclib [as 别名]
# 或者: from xmlrpclib import Server [as 别名]
def start(self):
        server = Server(self.server_url)
        self.graph = server.ubigraph

        # Create a graph
        for i in range(0, 10):
            self.graph.new_vertex_w_id(i)

        # Make some edges
        for i in range(0, 10):
            self.graph.new_edge(i, (i + 1) % 10) 
开发者ID:zchengquan,项目名称:TextDetector,代码行数:13,代码来源:ubigraph.py


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