本文整理汇总了Python中SimpleXMLRPCServer.register_introspection_functions方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleXMLRPCServer.register_introspection_functions方法的具体用法?Python SimpleXMLRPCServer.register_introspection_functions怎么用?Python SimpleXMLRPCServer.register_introspection_functions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleXMLRPCServer
的用法示例。
在下文中一共展示了SimpleXMLRPCServer.register_introspection_functions方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import register_introspection_functions [as 别名]
def main():
print ("init")
server = SimpleXMLRPCServer(('0.0.0.0', int(SLAVE_DAEMON_PORT)))
server.register_introspection_functions()
server.register_instance(Node())
print ("starting server")
server.serve_forever()
示例2: main
# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import register_introspection_functions [as 别名]
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "hs:p:", ["help"])
serv = "localhost"
port = 8088
for opt, val in opts:
if opt in ("-h", "--help"):
usage()
sys.exit(0)
elif opt == "-s":
serv = val
elif opt == "-p":
port = int(val)
server = SimpleXMLRPCServer((serv, port), RequestHandler, True, True)
server.register_introspection_functions()
server.serve_forever()
except getopt.GetoptError as err:
print str(err)
usage()
sys.exit(1)
except ValueError:
usage()
sys.exit(1)
except KeyboardInterrupt:
sys.exit(0)
示例3: run
# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import register_introspection_functions [as 别名]
def run(self):
class RequestHandler(SimpleXMLRPCRequestHandler):
rpc_paths = ('/RPC2',)
#create a server
server = SimpleXMLRPCServer(("localhost",8045),requestHandler = RequestHandler)
server.register_introspection_functions()
def transmit_orbited(channel, message):
"""
@param channel: The stomp channel to send to
@param message: The message that needs to be transmitted
"""
self.orbited.send_data(channel, message)
return ""
server.register_function(transmit_orbited, 'transmit')
server.serve_forever()
示例4: run
# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import register_introspection_functions [as 别名]
def run(self):
se = SimpleXMLRPCServer((shared.config.get('bitmessagesettings', 'apiinterface'), shared.config.getint(
'bitmessagesettings', 'apiport')), MySimpleXMLRPCRequestHandler, True, True)
se.register_introspection_functions()
se.serve_forever()
示例5: runServer
# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import register_introspection_functions [as 别名]
def runServer(port):
server = SimpleXMLRPCServer(("", port))
server.register_instance(Functions())
server.register_introspection_functions()
server.register_multicall_functions()
server.serve_forever()
示例6: dict
# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import register_introspection_functions [as 别名]
'''Handle XML-RPC 'getStatus' requests, returning current Spectracom status.
'''
# XML-RPC needs a simple dictionary, so reinterpret
# collector.getLatestStatus() as a plain dict
return dict(collector.getLatestStatus())
# Create our XML-RPC server
try:
serverXMLRPC = SimpleXMLRPCServer(('0.0.0.0', getDaemonXmlRpcPort()),
SimpleXMLRPCRequestHandler,
logRequests = False)
except socket.error as e:
_logger.error('Exiting on error creating XML-RPC server: %s' % (e))
sys.exit(1)
serverXMLRPC.register_introspection_functions()
serverXMLRPC.register_function(getStatus)
# Initiate regular registration with procmap
procmapRegister()
# Method to handle failure of our StatusCollector
def onStatusCollectorFailure():
'''Callback which handles StatusCollector failure
'''
_logger.error('StatusCollector has died. Exiting program.')
# Stop the XML-RPC server to exit serve_forever
global stopping
stopping = True
serverXMLRPC.server_close()
示例7: hello_world
# 需要导入模块: import SimpleXMLRPCServer [as 别名]
# 或者: from SimpleXMLRPCServer import register_introspection_functions [as 别名]
return retstr
else:
return 'Invalid Method [%s]'%method
# functions available as web services
class XMLRPC_register:
def hello_world(self, t1, t2, validuser):
if validuser:
return t1+'-'+t2
else:
return "please register ur machine"
if __name__ == '__main__':
try:
se = SimpleXMLRPCServer(("localhost",8088), MySimpleXMLRPCRequestHandler, True, True)
se.register_introspection_functions()
se.serve_forever()
except KeyboardInterrupt:
print "Bye"
#--------------------- new file starts here-----------
### client.py
import os
import base64
import xmlrpclib
import urllib2
import cookielib
class CookieAuthXMLRPCTransport(xmlrpclib.Transport):
""" xmlrpclib.Transport that sends basic HTTP Authentication"""