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


Python DocXMLRPCServer.register_introspection_functions方法代码示例

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


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

示例1: make_server

# 需要导入模块: from DocXMLRPCServer import DocXMLRPCServer [as 别名]
# 或者: from DocXMLRPCServer.DocXMLRPCServer import register_introspection_functions [as 别名]
def make_server():
    serv = DocXMLRPCServer(("localhost", 0), logRequests=False)

    try:
        # Add some documentation
        serv.set_server_title("DocXMLRPCServer Test Documentation")
        serv.set_server_name("DocXMLRPCServer Test Docs")
        serv.set_server_documentation(
            "This is an XML-RPC server's documentation, but the server "
            "can be used by POSTing to /RPC2. Try self.add, too.")

        # Create and register classes and functions
        class TestClass(object):
            def test_method(self, arg):
                """Test method's docs. This method truly does very little."""
                self.arg = arg

        serv.register_introspection_functions()
        serv.register_instance(TestClass())

        def add(x, y):
            """Add two instances together. This follows PEP008, but has nothing
            to do with RFC1952. Case should matter: pEp008 and rFC1952.  Things
            that start with http and ftp should be auto-linked, too:
            http://google.com.
            """
            return x + y

        serv.register_function(add)
        serv.register_function(lambda x, y: x-y)
        return serv
    except:
        serv.server_close()
        raise
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:36,代码来源:test_docxmlrpc.py

示例2: testserver

# 需要导入模块: from DocXMLRPCServer import DocXMLRPCServer [as 别名]
# 或者: from DocXMLRPCServer.DocXMLRPCServer import register_introspection_functions [as 别名]
def testserver():

    class ThreadingServer(ThreadingMixIn,DocXMLRPCServer):
        pass

    server = DocXMLRPCServer(('localhost',8888),DocXMLRPCRequestHandler,allow_none=True)
    server.set_server_title("Chapter 18 document")
    server.set_server_name("chapter")
    server.set_server_documentation("""welcome""")
    server.register_instance(Math())
    server.register_introspection_functions()
    server.register_function(int)
    server.register_function(list.sort)
开发者ID:huangnauh,项目名称:learnpython,代码行数:15,代码来源:cgi108.py

示例3: start

# 需要导入模块: from DocXMLRPCServer import DocXMLRPCServer [as 别名]
# 或者: from DocXMLRPCServer.DocXMLRPCServer import register_introspection_functions [as 别名]
def start():
    """
    Start the XML-RPC server, and print out the port number that it is
    listening on.
    """

    server = XMLRPCServer(("127.0.0.1", 0), JPushyXMLRPCRequestHandler)

    # print out the port number
    print server.socket.getsockname()[1]
    sys.stdout.flush()

    server.allow_none = True
    server.register_introspection_functions()
    server.register_instance(JPushyFunctions())
    server.serve_forever()
开发者ID:alfredodeza,项目名称:pushy,代码行数:18,代码来源:jpushy.py

示例4: start

# 需要导入模块: from DocXMLRPCServer import DocXMLRPCServer [as 别名]
# 或者: from DocXMLRPCServer.DocXMLRPCServer import register_introspection_functions [as 别名]
def start( address, scheduler, debug=False ):
    global count

    if debug:
        s = DocXMLRPCServer( address, allow_none=True )
        s.register_introspection_functions()
    else:
        s = SimpleXMLRPCServer( address, allow_none=True )
    handler = RPCHandler( scheduler )
    s.register_multicall_functions()
    s.register_instance( handler )
    s.thread = threading.Thread( name="RPC", target=s.serve_forever )
    s.thread.daemon = True
    s.thread.start()
    logging.info( "rpc interface started" )
    return s, s.thread, handler
开发者ID:koenbollen,项目名称:pollbuster,代码行数:18,代码来源:rpc.py

示例5: server

# 需要导入模块: from DocXMLRPCServer import DocXMLRPCServer [as 别名]
# 或者: from DocXMLRPCServer.DocXMLRPCServer import register_introspection_functions [as 别名]
def server(evt, numrequests):
    serv = DocXMLRPCServer(("localhost", 0), logRequests=False)

    try:
        global PORT
        PORT = serv.socket.getsockname()[1]

        # Add some documentation
        serv.set_server_title("DocXMLRPCServer Test Documentation")
        serv.set_server_name("DocXMLRPCServer Test Docs")
        serv.set_server_documentation(
            """This is an XML-RPC server's documentation, but the server can be used by
POSTing to /RPC2. Try self.add, too."""
        )

        # Create and register classes and functions
        class TestClass(object):
            def test_method(self, arg):
                """Test method's docs. This method truly does very little."""
                self.arg = arg

        serv.register_introspection_functions()
        serv.register_instance(TestClass())

        def add(x, y):
            """Add two instances together. This follows PEP008, but has nothing
            to do with RFC1952. Case should matter: pEp008 and rFC1952.  Things
            that start with http and ftp should be auto-linked, too:
            http://google.com.
            """
            return x + y

        serv.register_function(add)
        serv.register_function(lambda x, y: x - y)

        while numrequests > 0:
            serv.handle_request()
            numrequests -= 1
    except socket.timeout:
        pass
    finally:
        serv.server_close()
        PORT = None
        evt.set()
开发者ID:Cinnz,项目名称:python,代码行数:46,代码来源:test_docxmlrpc.py

示例6: run

# 需要导入模块: from DocXMLRPCServer import DocXMLRPCServer [as 别名]
# 或者: from DocXMLRPCServer.DocXMLRPCServer import register_introspection_functions [as 别名]
	def run( s ):
		server = DocXMLRPCServer( (s.host_name, s.port_number),
					  logRequests=0 )
		server.register_function( s.notify )
		server.register_function( s.create_user )
		server.register_function( s.delete_user )
		server.register_function( s.email_pw )
		server.register_function( s.change_pw )
		server.register_function( s.create_namespace )
		server.register_function( s.delete_namespace )
		server.register_function( s.set )
		server.register_function( s.unset )
		server.register_function( s.get_description_url )
		server.register_introspection_functions()

		print time.asctime(), "Local Names Store Server Starts - %s:%s" % (s.host_name,
									  s.port_number)
		try:
			server.serve_forever()
		except KeyboardInterrupt:
			pass
		print time.asctime(), "Local Names Store Server Stops - %s:%s" % (s.host_name,
                                                             s.port_number)
开发者ID:BackupTheBerlios,项目名称:onebigsoup-svn,代码行数:25,代码来源:lnss_server.py

示例7: sumAndDifference

# 需要导入模块: from DocXMLRPCServer import DocXMLRPCServer [as 别名]
# 或者: from DocXMLRPCServer.DocXMLRPCServer import register_introspection_functions [as 别名]
#!/usr/bin/python

from DocXMLRPCServer import DocXMLRPCServer


def sumAndDifference(x,y):
    """This method returns sum and difference of arguments
       as struct with two fields: 'sum' and 'difference'"""
    
    return {'sum':x+y,'difference':x-y}

server = DocXMLRPCServer(("localhost", 5777))
server.register_function(sumAndDifference,"sample.sumAndDifference")
server.register_introspection_functions()
server.register_multicall_functions()
server.serve_forever()
开发者ID:wojtekzozlak,项目名称:Studia.Archiwum,代码行数:18,代码来源:PythonSelfDocServer.py


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