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


Python SimpleXMLRPCServer.SimpleXMLRPCDispatcher类代码示例

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


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

示例1: __init__

    def __init__(self, requestHandler, logRequests=True, allow_none=False,
                 encoding=None):
        self.logRequests = logRequests

        SimpleXMLRPCDispatcher.__init__(self, allow_none=allow_none,
                                        encoding=encoding)
        ConnectedTCPServer.__init__(self, requestHandler)
开发者ID:Caez83,项目名称:vdsm,代码行数:7,代码来源:xmlrpc.py

示例2: CreateApp

    def CreateApp(self, name):
        """
        Creates new app.
        
        @param name: Name of an app.
        @type name: C{str}
        
        @return: Instance id of an app.
        @rtype: C{int}
        """ 
        if not self.Apps:
            return 0
        if name not in self.Apps:
            return 0

        id= int(random.getrandbits(16))
        print self.Apps[name]
        if not self.instances:
            self.instances= {}
        self.instances[id]= (self.Apps[name](), name,)

        dispatcher= SimpleXMLRPCDispatcher()
        dispatcher.register_introspection_functions()
        dispatcher.register_instance(self.instances[id][0])
        self.server.add_dispatcher( "/"+str(id), dispatcher)

        return id
开发者ID:offlinehacker-playground,项目名称:rocketeer,代码行数:27,代码来源:server.py

示例3: __init__

 def __init__(self, allow_none=False, encoding=None):
     try:
         SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding)
     except TypeError:
         # see http://bugs.debian.org/470645
         # python2.4 and before only took one argument
         SimpleXMLRPCDispatcher.__init__(self)
开发者ID:chrismgray,项目名称:ikiwiki,代码行数:7,代码来源:proxy.py

示例4: __init__

 def __init__(self, no_introspection=False):
     if sys.version_info[:2] < (2, 5):
         SimpleXMLRPCDispatcher.__init__(self)
     else:
         SimpleXMLRPCDispatcher.__init__(self, False, 'utf-8')
     if not no_introspection:
         self.register_introspection_functions()
开发者ID:UfSoft,项目名称:screener,代码行数:7,代码来源:__init__.py

示例5: __init__

    def __init__(self, registerInstance, server_address, keyFile=DEFAULTKEYFILE,
            certFile=DEFAULTCERTFILE, caFile = DEFAULTCAFILE, logRequests=True):
        """Secure Documenting XML-RPC server.
        It it very similar to DocXMLRPCServer but it uses HTTPS for transporting XML data.
        """
        SimpleXMLRPCServer.__init__(self, server_address, SecureXMLRPCRequestHandler, logRequests)
        self.logRequests = logRequests

        self.register_introspection_functions()

        # init stuff, handle different versions:
        try:
            SimpleXMLRPCDispatcher.__init__(self)
        except TypeError:
            # An exception is raised in Python 2.5 as the prototype of the __init__
            # method has changed and now has 3 arguments (self, allow_none, encoding)
            SimpleXMLRPCDispatcher.__init__(self, False, None)
        SocketServer.BaseServer.__init__(self, server_address, SecureXMLRPCRequestHandler)
        self.register_instance(registerInstance) # for some reason, have to register instance down here!

        # SSL socket stuff
        ctx = SSL.Context(SSL.SSLv23_METHOD)
        ctx.use_privatekey_file(keyFile)
        ctx.use_certificate_file(certFile)
        # verify
        ctx.load_verify_locations(caFile)
        ctx.set_verify(SSL.VERIFY_PEER|SSL.VERIFY_FAIL_IF_NO_PEER_CERT, self._verify)
        self.socket = SSL.Connection(ctx, socket.socket(self.address_family, self.socket_type))
        self.server_bind()
        self.server_activate()

        # requests count and condition, to allow for keyboard quit via CTL-C
        self.requests = 0
        self.rCondition = Condition()
开发者ID:hizel,项目名称:twistsnmp,代码行数:34,代码来源:securexmlrpc.py

示例6: post

    def post(self, request):
        dispatcher = SimpleXMLRPCDispatcher(allow_none=False, encoding=None)
        dispatcher.register_function(partial(self.ping, request), 'pingback:ping')

        response = HttpResponse(mimetype="application/xml")
        response.write(dispatcher._marshaled_dispatch(request.raw_post_data))
        return response
开发者ID:graingert,项目名称:humfrey,代码行数:7,代码来源:views.py

示例7: __init__

 def __init__(self):
     #: Python 2.5 requires some arguments like `allow_none`
     #: and the encoding. Python 2.4 and 2.3 doesn't.
     if sys.version_info[:2] < (2, 5):
         SimpleXMLRPCDispatcher.__init__(self)
     else:
         SimpleXMLRPCDispatcher.__init__(self, True, 'utf-8')
开发者ID:7thStreet,项目名称:lodgeit,代码行数:7,代码来源:xmlrpc.py

示例8: __init__

 def __init__(self, path):
     path = to_unicode(path)
     SimpleXMLRPCDispatcher.__init__(self, True, 'utf-8')
     self.register_introspection_functions()
     self.register_multicall_functions()
     self.instance = self.instance_class(path)
     self.path = path
开发者ID:nsi-iff,项目名称:pyOLS,代码行数:7,代码来源:main.py

示例9: __init__

	def __init__(self,application, request, transforms=None):
		tornado.web.RequestHandler.__init__(self,application, request, transforms)

		SimpleXMLRPCDispatcher.__init__(self,True,None)

		self.register_multicall_functions()

		self.register_methods()
开发者ID:leadernux,项目名称:etornado,代码行数:8,代码来源:xmlrpc.py

示例10: __init__

 def __init__(self, prefix):
     self.prefix = prefix
     try:
         # Python 2.4
         self.dispatcher = SimpleXMLRPCDispatcher()
     except TypeError:
         # Python 2.5
         self.dispatcher = SimpleXMLRPCDispatcher(allow_none=False, encoding=None)
开发者ID:pombredanne,项目名称:turbion,代码行数:8,代码来源:xmlrpc.py

示例11: __init__

 def __init__(self, clientHost, clientPort):
     SimpleXMLRPCDispatcher.__init__(self)
     ThreadingTCPServer.__init__(self,
                                 (clientHost, clientPort),
                                 SimpleXMLRPCRequestHandler)
     self.logRequests = 1
     self.client = AdminControlInterface()
     self.register_introspection_functions()
     self.register_instance(self.client)
开发者ID:giffels,项目名称:PRODAGENT,代码行数:9,代码来源:AdminControlServer.py

示例12: Server

class Server(Thread):
    """
    XML-RPC server.
    """ 

    @LogCall()
    def __init__(self, requestHandler, host="localhost", port=8400):
        """
        Initializes server.
        
        @param requestHandler: Request handler for base class calls.
        @type requestHandler: C{AppsHandler}
        @param host: Host where to bind.
        @type host: C{str}
        @param port: Port where to bind.
        @type port: C{int}
        
        @return: Instance of self.
        @rtype: C{Server}
        """ 
        Thread.__init__(self)

        self.server = MultiPathXMLRPCServer((host, port), requestHandler=RHandler)
        self.requestHandler= requestHandler(self.server, False)
        self.dispatcher= SimpleXMLRPCDispatcher()
        self.dispatcher.register_introspection_functions()
        self.dispatcher.register_instance(self.requestHandler)
        self.server.add_dispatcher("/", self.dispatcher)

    @LogCall({"level": INFO})
    def run(self):
        """
        Runs server.
        
        @return: Nothing
        @rtype: C{None}
        """ 
        self.server.serve_forever()

    @LogCall({"level": INFO})
    def __del__(self):
        """
        Stops server.
        
        @return: Nothing
        @rtype: C{None}
        """ 
        self.server.shutdown()

    def GetRequestHandler(self):
        """
        Gets base request handler used with this server.
        
        @return: Request handler used with this server.
        @rtype: C{AppsHandler}
        """ 
        return self.requestHandler
开发者ID:offlinehacker-playground,项目名称:rocketeer,代码行数:57,代码来源:server.py

示例13: __init__

 def __init__(self, addr, requestHandler=RequestHandler):
     self.logRequests = 0
     if os.path.exists(addr):
         os.unlink(addr)
     dir = os.path.dirname(addr)
     if not(os.path.exists(dir)):
         os.makedirs(dir)
     SimpleXMLRPCDispatcher.__init__(self)
     UnixStreamServer.__init__(self, addr, requestHandler)
开发者ID:robhoes,项目名称:xapi-storage,代码行数:9,代码来源:__init__.py

示例14: __init__

    def __init__(self, allow_none=True, encoding=None):
        if sys.version_info[:2] == (2, 4):
            # doesn't support extra args in python 2.4
            SimpleXMLRPCDispatcher.__init__(self)
        else:
            SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding)

        self.allow_none = allow_none
        self.encoding = encoding
        self.register_multicall_functions()
开发者ID:jhornice,项目名称:preupgrade-assistant,代码行数:10,代码来源:dispatcher.py

示例15: __init__

    def __init__(self, requestHandler=IPXMLRPCRequestHandler,
                 logRequests=False, allow_none=False, encoding=None):
        SimpleXMLRPCDispatcher.__init__(self, allow_none=allow_none,
                                        encoding=encoding)

        self.requestHandler = requestHandler
        self.logRequests = logRequests

        # TODO provide proper limit for this queue
        self.queue = TaskQueue(sys.maxint)
开发者ID:fancyKai,项目名称:vdsm,代码行数:10,代码来源:xmlrpc.py


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