Server to expose an FS via XML-RPC
This module provides the necessary infrastructure to expose an FS object over XML-RPC. The main class is ‘RPCFSServer’, a SimpleXMLRPCServer subclass designed to expose an underlying FS.
If you need to use a more powerful server than SimpleXMLRPCServer, you can use the RPCFSInterface class to provide an XML-RPC-compatible wrapper around an FS object, which can then be exposed using whatever server you choose (e.g. Twisted’s XML-RPC server).
Wrapper to expose an FS via a XML-RPC compatible interface.
The only real trick is using xmlrpclib.Binary objects to transport the contents of files.
Decode paths arriving over the wire.
Encode a filesystem path for sending over the wire.
Unfortunately XMLRPC only supports ASCII strings, so this method must return something that can be represented in ASCII. The default is base64-encoded UTF-8.
RPCFSServer(fs, addr, requestHandler=None, logRequests=None)¶
Server to expose an FS object via XML-RPC.
This class takes as its first argument an FS instance, and as its second argument a (hostname,port) tuple on which to listen for XML-RPC requests. Example:
fs = OSFS('/var/srv/myfiles') s = RPCFSServer(fs,("",8080)) s.serve_forever()
To cleanly shut down the server after calling serve_forever, set the attribute “serve_more_requests” to False.
Override serve_forever to allow graceful shutdown.