コード例 #1
0
ファイル: json.py プロジェクト: EstebanCoto/evok
class JSONRPCLibraryWrapper(object):

    dumps = dumps
    loads = loads
    Fault = Fault


class JSONRPCHandler(BaseRPCHandler):
    """
    Subclass this to add methods -- you can treat them
    just like normal methods, this handles the JSON formatting.
    """
    _RPC_ = JSONRPCParser(JSONRPCLibraryWrapper)


if __name__ == '__main__':
    # Example Implementation
    import sys
    from tornadorpc.base import start_server
    from tornadorpc.base import TestRPCHandler

    class TestJSONRPC(TestRPCHandler):
        _RPC_ = JSONRPCParser(JSONRPCLibraryWrapper)

    port = 8181
    if len(sys.argv) > 1:
        port = int(sys.argv[1])

    print 'Starting server on port %s' % port
    start_server(TestJSONRPC, port=port)
コード例 #2
0
ファイル: xml.py プロジェクト: martyy665/test-mirror-evok
class XMLRPCHandler(BaseRPCHandler):
    """
    Subclass this to add methods -- you can treat them
    just like normal methods, this handles the XML formatting.
    """
    _RPC_ = XMLRPCParser(xmlrpclib)

    @property
    def system(self):
        return XMLRPCSystem(self)


if __name__ == '__main__':
    # Test implementation
    from tornadorpc.base import TestRPCHandler, start_server
    import sys

    port = 8282
    if len(sys.argv) > 1:
        port = int(sys.argv[1])

    class TestXMLRPC(TestRPCHandler):
        _RPC_ = XMLRPCParser(xmlrpclib)

        @property
        def system(self):
            return XMLRPCSystem(self)

    print 'Starting server on port %s' % port
    start_server(TestXMLRPC, port=port)
コード例 #3
0
ファイル: json.py プロジェクト: olemis/tornadorpc
        return '[ %s ]' % ', '.join(response_list)
        
class JSONRPCLibraryWrapper(object):
    
    dumps = dumps
    loads = loads
    Fault = Fault

class JSONRPCHandler(BaseRPCHandler):
    """
    Subclass this to add methods -- you can treat them
    just like normal methods, this handles the JSON formatting.
    """
    _RPC_ = JSONRPCParser(JSONRPCLibraryWrapper)

if __name__ == '__main__':
    # Example Implementation
    import sys
    from tornadorpc.base import start_server
    from tornadorpc.base import TestRPCHandler

    class TestJSONRPC(TestRPCHandler):
        _RPC_ = JSONRPCParser(JSONRPCLibraryWrapper)
    
    port = 8181
    if len(sys.argv) > 1:
        port = int(sys.argv[1])
        
    print 'Starting server on port %s' % port
    start_server(TestJSONRPC, port=port)