當前位置: 首頁>>代碼示例>>Python>>正文


Python DocXMLRPCServer.__init__方法代碼示例

本文整理匯總了Python中DocXMLRPCServer.DocXMLRPCServer.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python DocXMLRPCServer.__init__方法的具體用法?Python DocXMLRPCServer.__init__怎麽用?Python DocXMLRPCServer.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DocXMLRPCServer.DocXMLRPCServer的用法示例。


在下文中一共展示了DocXMLRPCServer.__init__方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from DocXMLRPCServer import DocXMLRPCServer [as 別名]
# 或者: from DocXMLRPCServer.DocXMLRPCServer import __init__ [as 別名]
    def __init__(self, addr):
        DocXMLRPCServer.__init__(self, addr, logRequests=True)
        self.register_introspection_functions()
        self.allow_none = True
        self.set_server_title('ZDStack')
        self.set_server_name('ZDStack XML-RPC API')
        self.set_server_documentation("""\
This is the documentation for the ZDStack XML-RPC API.  For more information, visit
http://zdstack.googlecode.com.""")
開發者ID:camgunz,項目名稱:zdstack,代碼行數:11,代碼來源:XMLRPCServer.py

示例2: __init__

# 需要導入模塊: from DocXMLRPCServer import DocXMLRPCServer [as 別名]
# 或者: from DocXMLRPCServer.DocXMLRPCServer import __init__ [as 別名]
	def __init__(self, registerInstance, server_address, keyFile=DEFAULTKEYFILE, certFile=DEFAULTCERTFILE, logRequests=True):
		"""Secure Documenting XML-RPC server.
		It it very similar to DocXMLRPCServer but it uses HTTPS for transporting XML data.
		"""
		DocXMLRPCServer.__init__(self, server_address, SecureDocXMLRpcRequestHandler, logRequests,True)
		self.logRequests = logRequests

		# stuff for doc server
		try: self.set_server_title(registerInstance.title)
		except AttributeError: self.set_server_title('N4D Documentation page')
		try: self.set_server_name(registerInstance.name)
		except AttributeError: self.set_server_name('N4D')
		#for plugin in registerInstace
		if registerInstance.__doc__: self.set_server_documentation(registerInstance.__doc__)
		else: self.set_server_documentation('default documentation')
		
		
		#self.register_introspection_functions()
		
		# init stuff, handle different versions:
		try:
			SimpleXMLRPCServer.SimpleXMLRPCDispatcher.__init__(self,allow_none=True)
		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)
			SimpleXMLRPCServer.SimpleXMLRPCDispatcher.__init__(self, allow_none=True, encoding=None)
		SocketServer.BaseServer.__init__(self, server_address, SecureDocXMLRpcRequestHandler)
		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)
		self.socket = SSL.Connection(ctx, socket.socket(self.address_family, self.socket_type))
		
		old = fcntl.fcntl(self.socket.fileno(), fcntl.F_GETFD)	
		fcntl.fcntl(self.socket.fileno(), fcntl.F_SETFD, old | fcntl.FD_CLOEXEC)	
		
		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:raurodse,項目名稱:N4D,代碼行數:46,代碼來源:server.py

示例3: __init__

# 需要導入模塊: from DocXMLRPCServer import DocXMLRPCServer [as 別名]
# 或者: from DocXMLRPCServer.DocXMLRPCServer import __init__ [as 別名]
 def __init__(self, users_auth, addr, timeout=0.5, *args, **kargs):
     # we use an inner class so that we can call out to the
     # authenticate method
     class VerifyingRequestHandler(DocXMLRPCRequestHandler):
         def parse_request(myself):
             # first, call the original implementation which returns
             # True if all OK so far
             if DocXMLRPCRequestHandler.parse_request(myself):
                 # next we authenticate
                 if self.authenticate(myself.headers):
                     return True
                 else:
                     # if authentication fails, tell the client
                     myself.send_error(401, 'Authentication failed')
             return False
     self._users_auth = users_auth
     self._finished = False
     self.timeout = timeout
     DocXMLRPCServer.__init__(self, addr, *args, requestHandler=VerifyingRequestHandler, **kargs)
開發者ID:mabl,項目名稱:nanowrite_wrapper,代碼行數:21,代碼來源:nanowrite_server.py

示例4: __init__

# 需要導入模塊: from DocXMLRPCServer import DocXMLRPCServer [as 別名]
# 或者: from DocXMLRPCServer.DocXMLRPCServer import __init__ [as 別名]
    def __init__(self, registerInstance, server_address, keyFile=DEFAULTKEYFILE, certFile=DEFAULTCERTFILE, logRequests=True):
        """Secure Documenting XML-RPC server.
        It it very similar to DocXMLRPCServer but it uses HTTPS for transporting XML data.
        """
        DocXMLRPCServer.__init__(self, server_address, SecureDocXMLRpcRequestHandler, logRequests)
        self.logRequests = logRequests

        # stuff for doc server
        try: self.set_server_title(registerInstance.title)
        except AttributeError: self.set_server_title('default title')
        try: self.set_server_name(registerInstance.name)
        except AttributeError: self.set_server_name('default name')
        if registerInstance.__doc__: self.set_server_documentation(registerInstance.__doc__)
        else: self.set_server_documentation('default documentation')
        self.register_introspection_functions()

        # init stuff, handle different versions:
        try:
            SimpleXMLRPCServer.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)
            SimpleXMLRPCServer.SimpleXMLRPCDispatcher.__init__(self, False, None)
        SocketServer.BaseServer.__init__(self, server_address, SecureDocXMLRpcRequestHandler)
        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('cert/rpc-ca.crt')
        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,代碼行數:42,代碼來源:mainsrv.py

示例5: __init__

# 需要導入模塊: from DocXMLRPCServer import DocXMLRPCServer [as 別名]
# 或者: from DocXMLRPCServer.DocXMLRPCServer import __init__ [as 別名]
	def __init__(self, registerInstance, server_address, logRequests=True):
		"""Secure Documenting XML-RPC server.
		It it very similar to DocXMLRPCServer but it uses HTTPS for transporting XML data.
		"""
		DocXMLRPCServer.__init__(self, server_address, RPCHandler, logRequests)
		self.logRequests = logRequests

		# stuff for doc server
		try: self.set_server_title(registerInstance.title)
		except AttributeError: self.set_server_title('default title')
		try: self.set_server_name(registerInstance.name)
		except AttributeError: self.set_server_name('default name')
		if registerInstance.__doc__: self.set_server_documentation(registerInstance.__doc__)
		else: self.set_server_documentation('default documentation')
		self.register_introspection_functions()

		# init stuff, handle different versions:
		try:
			SimpleXMLRPCServer.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)
			SimpleXMLRPCServer.SimpleXMLRPCDispatcher.__init__(self, False, None)
		SocketServer.BaseServer.__init__(self, server_address, RPCHandler)
		self.register_instance(registerInstance) # for some reason, have to register instance down here!

		# SSL socket stuff
		ctx = SSL.Context(SSL.SSLv23_METHOD)
		keyfile = os.path.join(Config.djangoroot, Config.get("xmlrpc-server", "keyfile"))
		certfile = os.path.join(Config.djangoroot, Config.get("xmlrpc-server", "certfile"))
		ctx.use_privatekey_file(keyfile)
		ctx.use_certificate_file(certfile)
		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:SnowmanRM,項目名稱:Snowman,代碼行數:41,代碼來源:xmlrpcserver.py

示例6: __init__

# 需要導入模塊: from DocXMLRPCServer import DocXMLRPCServer [as 別名]
# 或者: from DocXMLRPCServer.DocXMLRPCServer import __init__ [as 別名]
 def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=1):
     self.allow_reuse_address = True
     DocXMLRPCServer.__init__(self, addr, requestHandler=requestHandler, logRequests=logRequests)
開發者ID:aabhasgarg,項目名稱:accessgrid,代碼行數:5,代碼來源:AGXMLRPCServer.py

示例7: __init__

# 需要導入模塊: from DocXMLRPCServer import DocXMLRPCServer [as 別名]
# 或者: from DocXMLRPCServer.DocXMLRPCServer import __init__ [as 別名]
 def __init__(self, addr, handler):
     signal(SIGPIPE, SIG_IGN)
     DocXMLRPCServer.__init__(self, addr, handler)
     self.serving_posts = Array('i', 70)
     self.set_server_title('Premium HTTP Server')
開發者ID:kitbs,項目名稱:open-tran,代碼行數:7,代碼來源:PremiumHTTPServer.py

示例8: __init__

# 需要導入模塊: from DocXMLRPCServer import DocXMLRPCServer [as 別名]
# 或者: from DocXMLRPCServer.DocXMLRPCServer import __init__ [as 別名]
 def __init__(self):
     DocXMLRPCServer.__init__(self, ('0.0.0.0', 54000), logRequests=False)
     self.set_server_name("RSSI Proximity")
     self.register_function(self.getProximity)
開發者ID:guoyi03,項目名稱:Bluedar,代碼行數:6,代碼來源:BlueDarD.py


注:本文中的DocXMLRPCServer.DocXMLRPCServer.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。