本文整理汇总了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.""")
示例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()
示例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)
示例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()
示例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()
示例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)
示例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')
示例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)