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


Python SimpleXMLRPCServer.SimpleXMLRPCServer方法代码示例

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


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

示例1: test_basic

# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import SimpleXMLRPCServer [as 别名]
def test_basic(self):
        # check that flag is false by default
        flagval = SimpleXMLRPCServer.SimpleXMLRPCServer._send_traceback_header
        self.assertEqual(flagval, False)

        # enable traceback reporting
        SimpleXMLRPCServer.SimpleXMLRPCServer._send_traceback_header = True

        # test a call that shouldn't fail just as a smoke test
        try:
            p = xmlrpclib.ServerProxy(URL)
            self.assertEqual(p.pow(6,8), 6**8)
        except (xmlrpclib.ProtocolError, socket.error), e:
            # ignore failures due to non-blocking socket 'unavailable' errors
            if not is_unavailable_exception(e):
                # protocol error; provide additional information in test output
                self.fail("%s\n%s" % (e, getattr(e, "headers", ""))) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:19,代码来源:test_xmlrpc.py

示例2: test_fail_with_info

# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import SimpleXMLRPCServer [as 别名]
def test_fail_with_info(self):
        # use the broken message class
        SimpleXMLRPCServer.SimpleXMLRPCRequestHandler.MessageClass = FailingMessageClass

        # Check that errors in the server send back exception/traceback
        # info when flag is set
        SimpleXMLRPCServer.SimpleXMLRPCServer._send_traceback_header = True

        try:
            p = xmlrpclib.ServerProxy(URL)
            p.pow(6,8)
        except (xmlrpclib.ProtocolError, socket.error), e:
            # ignore failures due to non-blocking socket 'unavailable' errors
            if not is_unavailable_exception(e) and hasattr(e, "headers"):
                # We should get error info in the response
                expected_err = "invalid literal for int() with base 10: 'I am broken'"
                self.assertEqual(e.headers.get("x-exception"), expected_err)
                self.assertTrue(e.headers.get("x-traceback") is not None) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:20,代码来源:test_xmlrpc.py

示例3: _Open

# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import SimpleXMLRPCServer [as 别名]
def _Open(self, hostname, port):
    """Opens the RPC communication channel for clients.

    Args:
      hostname (str): hostname or IP address to connect to for requests.
      port (int): port to connect to for requests.

    Returns:
      bool: True if the communication channel was successfully opened.
    """
    try:
      self._xmlrpc_server = SimpleXMLRPCServer.SimpleXMLRPCServer(
          (hostname, port), logRequests=False, allow_none=True)
    except SocketServer.socket.error as exception:
      logger.warning((
          'Unable to bind a RPC server on {0:s}:{1:d} with error: '
          '{2!s}').format(hostname, port, exception))
      return False

    self._xmlrpc_server.register_function(
        self._callback, self._RPC_FUNCTION_NAME)
    return True 
开发者ID:log2timeline,项目名称:plaso,代码行数:24,代码来源:plaso_xmlrpc.py

示例4: main

# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import SimpleXMLRPCServer [as 别名]
def main():
    autoWait()
    ea = ScreenEA()

    server = SimpleXMLRPCServer(("localhost", 9000))
    server.register_function(is_connected, "is_connected")

    server.register_function(wrapper_get_raw, "get_raw")
    server.register_function(wrapper_get_function, "get_function")
    server.register_function(wrapper_Heads, "Heads")
    server.register_function(wrapper_Functions, "Functions")

    server.register_instance(IDAWrapper())

    server.register_function(wrapper_quit, "quit")
    server.serve_forever()

    qexit(0) 
开发者ID:DroidTest,项目名称:TimeMachine,代码行数:20,代码来源:idawrapper.py

示例5: main

# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import SimpleXMLRPCServer [as 别名]
def main() :
    autoWait()
    ea = ScreenEA()

    server = SimpleXMLRPCServer(("localhost", 9000))
    server.register_function(is_connected, "is_connected")
    
    server.register_function(wrapper_get_raw, "get_raw")
    server.register_function(wrapper_get_function, "get_function")
    server.register_function(wrapper_Heads, "Heads")
    server.register_function(wrapper_Functions, "Functions")
    
    server.register_instance(IDAWrapper())
    
    server.register_function(wrapper_quit, "quit")
    server.serve_forever()

    qexit(0) 
开发者ID:xtiankisutsa,项目名称:MARA_Framework,代码行数:20,代码来源:idawrapper.py

示例6: start_lobotomy

# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import SimpleXMLRPCServer [as 别名]
def start_lobotomy(bv):
    """
    Start the lobotomy service
    """
    # Locals
    HOST = "127.0.0.1"
    PORT = 6666
    rpc = None

    try:
        # Create a new SimpleXMLRPCServer instance with the
        # LobotomyRequestHandler
        rpc = SimpleXMLRPCServer((HOST, PORT),
                                 requestHandler=LobotomyRequestHandler,
                                 logRequests=False,
                                 allow_none=True)
        # Register the Lobotomy class
        rpc.register_instance(Lobotomy(rpc, bv))
        print("[*] Started lobotomy service (!)")
        while True:
            # Handle inbound requests
            rpc.handle_request()
    except Exception as e:
        ExceptionHandler(e) 
开发者ID:xtiankisutsa,项目名称:MARA_Framework,代码行数:26,代码来源:binja_lobotomy.py

示例7: start_xmlrpc_server

# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import SimpleXMLRPCServer [as 别名]
def start_xmlrpc_server():
    """
    Initialize the XMLRPC thread
    """
    print("[+] Starting XMLRPC server: {}:{}".format(HOST, PORT))
    server = SimpleXMLRPCServer((HOST, PORT),
                                requestHandler=RequestHandler,
                                logRequests=False,
                                allow_none=True)
    server.register_introspection_functions()
    server.register_instance( Gef(server) )
    print("[+] Registered {} functions.".format( len(server.system_listMethods()) ))
    while True:
        if hasattr(server, "shutdown") and server.shutdown==True:
            break
        server.handle_request()

    return 
开发者ID:gatieme,项目名称:GdbPlugins,代码行数:20,代码来源:ida_gef.py

示例8: listen

# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import SimpleXMLRPCServer [as 别名]
def listen(self, addr):
        """Starts the RPC server on the addrress.

        Args:
            addr: The tuple of listening address and port.

        Raises:
            RuntimeError: If the server is already running.
        """
        if not self.__done:
            raise RuntimeError('server is already running')

        self.__done = False
        # SimpleXMLRPCServer, by default, is IPv4 only. So we do some surgery.
        SocketServer.TCPServer.address_family = self.__ip_mode
        server = SimpleXMLRPCServer.SimpleXMLRPCServer(addr, allow_none=True)
        server.register_instance(self)
        while not self.__done:
            server.handle_request() 
开发者ID:google,项目名称:transperf,代码行数:21,代码来源:recv.py

示例9: setUp

# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import SimpleXMLRPCServer [as 别名]
def setUp(self):
        # enable traceback reporting
        SimpleXMLRPCServer.SimpleXMLRPCServer._send_traceback_header = True

        self.evt = threading.Event()
        # start server thread to handle requests
        serv_args = (self.evt, self.request_count, self.requestHandler)
        threading.Thread(target=self.threadFunc, args=serv_args).start()

        # wait for the server to be ready
        self.evt.wait(10)
        self.evt.clear() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:14,代码来源:test_xmlrpc.py

示例10: tearDown

# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import SimpleXMLRPCServer [as 别名]
def tearDown(self):
        # wait on the server thread to terminate
        self.evt.wait(10)

        # disable traceback reporting
        SimpleXMLRPCServer.SimpleXMLRPCServer._send_traceback_header = False

# NOTE: The tests in SimpleServerTestCase will ignore failures caused by
# "temporarily unavailable" exceptions raised in SimpleXMLRPCServer.  This
# condition occurs infrequently on some platforms, frequently on others, and
# is apparently caused by using SimpleXMLRPCServer with a non-blocking socket
# If the server class is updated at some point in the future to handle this
# situation more gracefully, these tests should be modified appropriately. 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:15,代码来源:test_xmlrpc.py

示例11: test_introspection4

# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import SimpleXMLRPCServer [as 别名]
def test_introspection4(self):
        # the SimpleXMLRPCServer doesn't support signatures, but
        # at least check that we can try making the call
        try:
            p = xmlrpclib.ServerProxy(URL)
            divsig = p.system.methodSignature('div')
            self.assertEqual(divsig, 'signatures not supported')
        except (xmlrpclib.ProtocolError, socket.error), e:
            # ignore failures due to non-blocking socket 'unavailable' errors
            if not is_unavailable_exception(e):
                # protocol error; provide additional information in test output
                self.fail("%s\n%s" % (e, getattr(e, "headers", ""))) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:14,代码来源:test_xmlrpc.py

示例12: test_dotted_attribute

# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import SimpleXMLRPCServer [as 别名]
def test_dotted_attribute(self):
        # Raises an AttributeError because private methods are not allowed.
        self.assertRaises(AttributeError,
                          SimpleXMLRPCServer.resolve_dotted_attribute, str, '__add')

        self.assertTrue(SimpleXMLRPCServer.resolve_dotted_attribute(str, 'title'))
        # Get the test to run faster by sending a request with test_simple1.
        # This avoids waiting for the socket timeout.
        self.test_simple1() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:test_xmlrpc.py

示例13: test_fail_no_info

# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import SimpleXMLRPCServer [as 别名]
def test_fail_no_info(self):
        # use the broken message class
        SimpleXMLRPCServer.SimpleXMLRPCRequestHandler.MessageClass = FailingMessageClass

        try:
            p = xmlrpclib.ServerProxy(URL)
            p.pow(6,8)
        except (xmlrpclib.ProtocolError, socket.error), e:
            # ignore failures due to non-blocking socket 'unavailable' errors
            if not is_unavailable_exception(e) and hasattr(e, "headers"):
                # The two server-side error headers shouldn't be sent back in this case
                self.assertTrue(e.headers.get("X-exception") is None)
                self.assertTrue(e.headers.get("X-traceback") is None) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:15,代码来源:test_xmlrpc.py


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