#!/usr/bin/env python2 import uuid from xmlrpc.server import SimpleXMLRPCServer from xmlrpc.server import SimpleXMLRPCRequestHandler # Restrict to a particular path. class RequestHandler(SimpleXMLRPCRequestHandler): rpc_paths = ('/RPC2',) # Create server server = SimpleXMLRPCServer(("localhost", 8000), requestHandler=RequestHandler) server.register_introspection_functions() # Register an instance; all the methods of the instance are # published as XML-RPC methods class CHAP: def __init__(self): self.key = 0; def init(self): self.key = str( uuid.uuid4() ) return self.key server.register_instance(CHAP()) # Run the server's main loop server.serve_forever()