Module Expr Str Import alias ImportFrom alias Import alias Import alias Import alias Import alias FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str orelse Assign NameStore ListLoad NameLoad For NameStore NameLoad body If Call AttributeLoad NameLoad attr Str body Raise Call NameLoad BinOpMod Str NameLoad orelse Assign NameStore Call NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return ListComp NameLoad comprehension NameStore Call NameLoad NameLoad BoolOpAnd UnaryOpNot Call AttributeLoad NameLoad attr Str Call NameLoad Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Dict For NameStore NameLoad body Assign SubscriptStore NameLoad Index NameLoad Num Return Call AttributeLoad NameLoad attr decorator_list ClassDef bases body Expr Str FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Dict Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Dict Str Str Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Dict Str AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad TryExcept body If CompareIsNot NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore TupleLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Num handlers ExceptHandler type NameLoad name NameStore body Assign NameStore Call AttributeLoad NameLoad attr NameLoad ExceptHandler body Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If CompareIsNot AttributeLoad NameLoad attr NameLoad body If Call NameLoad AttributeLoad NameLoad attr Str body Assign NameStore Call NameLoad BinOpAdd NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr orelse If UnaryOpNot Call NameLoad AttributeLoad NameLoad attr Str body Assign NameStore Call NameLoad BinOpAdd NameLoad Call NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore NameLoad If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad orelse If CompareIsNot AttributeLoad NameLoad attr NameLoad body If Call NameLoad AttributeLoad NameLoad attr Str body Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad orelse If UnaryOpNot Call NameLoad AttributeLoad NameLoad attr Str body TryExcept body Assign NameStore Call NameLoad AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad body Pass If CompareIs NameLoad NameLoad body Return Str orelse Import alias Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore SubscriptLoad NameLoad Index Str TryExcept body Expr Call AttributeLoad NameLoad attr ListLoad Call AttributeLoad NameLoad attr NameLoad NameLoad handlers ExceptHandler type NameLoad name NameStore body Expr Call AttributeLoad NameLoad attr Dict Str Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr ExceptHandler body Expr Call AttributeLoad NameLoad attr Dict Str Str Num BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore NameLoad TryExcept body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad handlers ExceptHandler type NameLoad body If CompareIsNot AttributeLoad NameLoad attr NameLoad body If Call NameLoad AttributeLoad NameLoad attr Str body Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad orelse TryExcept body Assign NameStore Call NameLoad AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad body Pass If CompareIsNot NameLoad NameLoad body Return Call NameLoad NameLoad orelse Raise Call NameLoad BinOpMod Str NameLoad decorator_list decorator_list ClassDef bases AttributeLoad NameLoad attr body Expr Str FunctionDef arguments args NameParam defaults body Expr Str TryExcept body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Call NameLoad NameLoad Str NameLoad handlers ExceptHandler body Expr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr orelse Expr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr Str Call NameLoad Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Num decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Str Str body Expr Str If AttributeLoad AttributeLoad NameLoad attr attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad decorator_list decorator_list ClassDef bases AttributeLoad NameLoad attr NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad Num body Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Print Str Print BinOpMod Str Call NameLoad NameLoad Print Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Num Assign TupleStore NameStore NameStore SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index NameLoad Assign NameStore BinOpMod AttributeLoad NameLoad attr Dict Str Str Str NameLoad NameLoad NameLoad Print BinOpMod Str TupleLoad NameLoad NameLoad Print Str Print BinOpMod Str Call NameLoad NameLoad Print Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If BoolOpAnd CompareIs NameLoad NameLoad CompareEq Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad Str body Expr Call AttributeLoad NameLoad attr orelse If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr NameLoad decorator_list decorator_list If CompareEq NameLoad Str body Assign NameStore Call NameLoad TupleLoad Str Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Lambda arguments args NameParam NameParam defaults BinOpAdd NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr
N/A N/A Simple XML-RPC Server.

This module can be used to create simple XML-RPC servers
by creating a server and either installing functions, a
class instance, or by extending the SimpleXMLRPCServer
class.

It can also be used to handle XML-RPC requests in a CGI
environment using CGIXMLRPCRequestHandler.

A list of possible usage patterns follows:

1. Install functions:

server = SimpleXMLRPCServer(("localhost", 8000))
server.register_function(pow)
server.register_function(lambda x,y: x+y, 'add')
server.serve_forever()

2. Install an instance:

class MyFuncs:
    def __init__(self):
        # make all of the string functions available through
        # string.func_name
        import string
        self.string = string
    def _listMethods(self):
        # implement this method so that system.listMethods
        # knows to advertise the strings methods
        return list_public_methods(self) +                 ['string.' + method for method in list_public_methods(self.string)]
    def pow(self, x, y): return pow(x, y)
    def add(self, x, y) : return x + y

server = SimpleXMLRPCServer(("localhost", 8000))
server.register_introspection_functions()
server.register_instance(MyFuncs())
server.serve_forever()

3. Install an instance with custom dispatch method:

class Math:
    def _listMethods(self):
        # this method must be present for system.listMethods
        # to work
        return ['add', 'pow']
    def _methodHelp(self, method):
        # this method must be present for system.methodHelp
        # to work
        if method == 'add':
            return "add(2,3) => 5"
        elif method == 'pow':
            return "pow(x, y[, z]) => number"
        else:
            # By convention, return empty
            # string if no help is available
            return ""
    def _dispatch(self, method, params):
        if method == 'pow':
            return pow(*params)
        elif method == 'add':
            return params[0] + params[1]
        else:
            raise 'bad method'

server = SimpleXMLRPCServer(("localhost", 8000))
server.register_introspection_functions()
server.register_instance(Math())
server.serve_forever()

4. Subclass SimpleXMLRPCServer:

class MathServer(SimpleXMLRPCServer):
    def _dispatch(self, method, params):
        try:
            # We are forcing the 'export_' prefix on methods that are
            # callable through XML-RPC to prevent potential security
            # problems
            func = getattr(self, 'export_' + method)
        except AttributeError:
            raise Exception('method "%s" is not supported' % method)
        else:
            return func(*params)

    def export_add(self, x, y):
        return x + y

server = MathServer(("localhost", 8000))
server.serve_forever()

5. CGI script:

server = CGIXMLRPCRequestHandler()
server.register_function(pow)
server.handle_request()
 N/A xmlrpclib xmlrpclib Fault N/A SocketServer N/A BaseHTTPServer N/A sys N/A os resolve_dotted_attribute N/A N/A obj attr allow_dotted_names N/A True N/A N/A resolve_dotted_attribute(a, 'b.c.d') => a.b.c.d

    Resolves a dotted attribute name to an object.  Raises
    an AttributeError if any attribute in the chain starts with a '_'.

    If the optional allow_dotted_names argument is false, dots are not
    supported and this function operates similar to getattr(obj, attr).
     N/A allow_dotted_names N/A N/A attrs N/A N/A attr split . N/A N/A attrs N/A attr N/A i attrs N/A N/A N/A N/A i startswith _ N/A N/A N/A AttributeError N/A attempt to access private attribute "%s" i N/A N/A obj N/A getattr obj i N/A obj N/A list_public_methods N/A N/A obj N/A N/A N/A Returns a list of attribute strings, found in the specified
    object, which represent callable attributes N/A N/A member N/A member N/A dir obj N/A N/A N/A N/A member startswith _ N/A callable N/A getattr obj member N/A remove_duplicates N/A N/A lst N/A N/A N/A remove_duplicates([2,2,2,1,3,3]) => [3,1,2]

    Returns a copy of a list without duplicates. Every list
    item must be hashable and the order of the items in the
    resulting list is not defined.
     N/A u N/A N/A x lst N/A N/A N/A u N/A x 1 N/A N/A N/A u keys N/A SimpleXMLRPCDispatcher N/A N/A N/A Mix-in class that dispatches XML-RPC requests.

    This class is used to register XML-RPC method handlers
    and then to dispatch them. There should never be any
    reason to instantiate this class directly.
     __init__ N/A N/A self N/A N/A N/A N/A self funcs N/A N/A N/A self instance None N/A register_instance N/A N/A self instance allow_dotted_names N/A False N/A N/A Registers an instance to respond to XML-RPC requests.

        Only one instance can be installed at a time.

        If the registered instance has a _dispatch method then that
        method will be called with the name of the XML-RPC method and
        its parameters as a tuple
        e.g. instance._dispatch('add',(2,3))

        If the registered instance does not have a _dispatch method
        then the instance will be searched to find a matching method
        and, if found, will be called. Methods beginning with an '_'
        are considered private and will not be called by
        SimpleXMLRPCServer.

        If a registered function matches a XML-RPC request, then it
        will be called instead of the registered instance.

        If the optional allow_dotted_names argument is true and the
        instance does not have a _dispatch method, method names
        containing dots are supported and resolved, as long as none of
        the name segments start with an '_'.

            *** SECURITY WARNING: ***

            Enabling the allow_dotted_names options allows intruders
            to access your module's global variables and may allow
            intruders to execute arbitrary code on your machine.  Only
            use this option on a secure, closed network.

         N/A N/A self instance instance N/A N/A self allow_dotted_names allow_dotted_names N/A register_function N/A N/A self function name N/A None N/A N/A Registers a function to respond to XML-RPC requests.

        The optional name argument can be used to set a Unicode name
        for the function.
         N/A N/A name None N/A N/A name N/A function __name__ N/A N/A N/A self funcs N/A name function N/A register_introspection_functions N/A N/A self N/A N/A N/A Registers the XML-RPC introspection methods in the system
        namespace.

        see http://xmlrpc.usefulinc.com/doc/reserved.html
         N/A N/A N/A N/A self funcs update N/A system.listMethods system.methodSignature system.methodHelp N/A self system_listMethods N/A self system_methodSignature N/A self system_methodHelp N/A register_multicall_functions N/A N/A self N/A N/A N/A Registers the XML-RPC multicall method in the system
        namespace.

        see http://www.xmlrpc.com/discuss/msgReader$1208 N/A N/A N/A N/A self funcs update N/A system.multicall N/A self system_multicall N/A _marshaled_dispatch N/A N/A self data dispatch_method N/A None N/A N/A Dispatches an XML-RPC method from marshalled (XML) data.

        XML-RPC methods are dispatched from the marshalled (XML) data
        using the _dispatch method and the result is returned as
        marshalled data. For backwards compatibility, a dispatch
        function can be provided as an argument (see comment in
        SimpleXMLRPCRequestHandler.do_POST) but overriding the
        existing method through subclassing is the prefered means
        of changing method dispatch behavior.
         N/A N/A params method N/A N/A xmlrpclib loads data N/A N/A N/A N/A dispatch_method None N/A N/A response N/A dispatch_method method params N/A N/A response N/A N/A self _dispatch method params N/A response N/A response N/A response N/A N/A xmlrpclib dumps response methodresponse 1 N/A N/A N/A Fault N/A fault N/A N/A response N/A N/A xmlrpclib dumps fault N/A N/A N/A response N/A N/A xmlrpclib dumps N/A N/A xmlrpclib Fault 1 N/A %s:%s N/A N/A sys exc_type N/A sys exc_value N/A response N/A system_listMethods N/A N/A self N/A N/A N/A system.listMethods() => ['add', 'subtract', 'multiple']

        Returns a list of the methods supported by the server. N/A methods N/A N/A N/A self funcs keys N/A N/A N/A self instance None N/A N/A N/A hasattr N/A self instance _listMethods N/A N/A methods N/A remove_duplicates N/A methods N/A N/A N/A self instance _listMethods N/A N/A N/A N/A hasattr N/A self instance _dispatch N/A N/A methods N/A remove_duplicates N/A methods N/A list_public_methods N/A self instance N/A N/A N/A methods sort N/A methods N/A system_methodSignature N/A N/A self method_name N/A N/A N/A system.methodSignature('add') => [double, int, int]

        Returns a list describing the signature of the method. In the
        above example, the add method takes two integers as arguments
        and returns a double result.

        This server does NOT support system.methodSignature. N/A signatures not supported N/A system_methodHelp N/A N/A self method_name N/A N/A N/A system.methodHelp('add') => "Adds two integers together"

        Returns a string containing documentation for the specified method. N/A method None N/A N/A N/A N/A self funcs has_key method_name N/A N/A method N/A N/A self funcs N/A method_name N/A N/A N/A N/A self instance None N/A N/A N/A hasattr N/A self instance _methodHelp N/A N/A N/A N/A N/A self instance _methodHelp method_name N/A N/A N/A N/A hasattr N/A self instance _dispatch N/A N/A N/A N/A method N/A resolve_dotted_attribute N/A self instance method_name N/A self allow_dotted_names N/A N/A N/A AttributeError N/A N/A N/A N/A method None N/A N/A N/A N/A pydoc N/A N/A N/A pydoc getdoc method N/A system_multicall N/A N/A self call_list N/A N/A N/A system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => [[4], ...]

        Allows the caller to package multiple XML-RPC calls into a single
        request.

        See http://www.xmlrpc.com/discuss/msgReader$1208
         N/A results N/A N/A call call_list N/A N/A method_name N/A call N/A methodName N/A params N/A call N/A params N/A N/A N/A N/A N/A results append N/A N/A N/A self _dispatch method_name params N/A N/A N/A Fault N/A fault N/A N/A N/A N/A results append N/A faultCode faultString N/A fault faultCode N/A fault faultString N/A N/A N/A N/A N/A results append N/A faultCode faultString 1 N/A %s:%s N/A N/A sys exc_type N/A sys exc_value N/A results N/A _dispatch N/A N/A self method params N/A N/A N/A Dispatches the XML-RPC method.

        XML-RPC calls are forwarded to a registered function that
        matches the called XML-RPC method name. If no such function
        exists then the call is forwarded to the registered instance,
        if available.

        If the registered instance has a _dispatch method then that
        method will be called with the name of the XML-RPC method and
        its parameters as a tuple
        e.g. instance._dispatch('add',(2,3))

        If the registered instance does not have a _dispatch method
        then the instance will be searched to find a matching method
        and, if found, will be called.

        Methods beginning with an '_' are considered private and will
        not be called.
         N/A func None N/A N/A N/A func N/A N/A self funcs N/A method N/A N/A N/A KeyError N/A N/A N/A N/A self instance None N/A N/A N/A hasattr N/A self instance _dispatch N/A N/A N/A N/A N/A self instance _dispatch method params N/A N/A N/A N/A func N/A resolve_dotted_attribute N/A self instance method N/A self allow_dotted_names N/A N/A N/A AttributeError N/A N/A N/A N/A func None N/A N/A N/A func params N/A N/A N/A Exception N/A method "%s" is not supported method N/A N/A SimpleXMLRPCRequestHandler N/A N/A BaseHTTPServer BaseHTTPRequestHandler N/A N/A Simple XML-RPC request handler class.

    Handles all HTTP POST requests and attempts to decode them as
    XML-RPC requests.
     do_POST N/A N/A self N/A N/A N/A Handles the HTTP POST request.

        Attempts to interpret all HTTP POST requests as XML-RPC calls,
        which are forwarded to the server's _dispatch method for handling.
         N/A N/A N/A data N/A N/A N/A self rfile read N/A int N/A N/A self headers N/A content-length N/A response N/A N/A N/A self server _marshaled_dispatch data N/A getattr self _dispatch None N/A N/A N/A N/A N/A N/A self send_response 500 N/A N/A N/A self end_headers N/A N/A N/A N/A self send_response 200 N/A N/A N/A self send_header Content-type text/xml N/A N/A N/A self send_header Content-length N/A str N/A len response N/A N/A N/A self end_headers N/A N/A N/A N/A self wfile write response N/A N/A N/A N/A self wfile flush N/A N/A N/A N/A self connection shutdown 1 N/A log_request N/A N/A self code size N/A - - N/A N/A Selectively log an accepted request. N/A N/A N/A self server logRequests N/A N/A N/A N/A N/A BaseHTTPServer BaseHTTPRequestHandler log_request self code size N/A N/A SimpleXMLRPCServer N/A N/A SocketServer TCPServer SimpleXMLRPCDispatcher N/A N/A Simple XML-RPC server.

    Simple XML-RPC server that allows functions and a single instance
    to be installed to handle requests. The default implementation
    attempts to dispatch XML-RPC calls to the functions or instance
    installed in the server. Override the _dispatch method inhereted
    from SimpleXMLRPCDispatcher to change this behavior.
     __init__ N/A N/A self addr requestHandler logRequests N/A SimpleXMLRPCRequestHandler 1 N/A N/A N/A self logRequests logRequests N/A N/A N/A SimpleXMLRPCDispatcher __init__ self N/A N/A N/A N/A SocketServer TCPServer __init__ self addr requestHandler N/A N/A CGIXMLRPCRequestHandler N/A SimpleXMLRPCDispatcher N/A N/A Simple handler for XML-RPC data passed through CGI. __init__ N/A N/A self N/A N/A N/A N/A N/A SimpleXMLRPCDispatcher __init__ self N/A handle_xmlrpc N/A N/A self request_text N/A N/A N/A Handle a single XML-RPC request N/A response N/A N/A self _marshaled_dispatch request_text N/A Content-Type: text/xml N/A N/A Content-Length: %d N/A len response N/A N/A N/A N/A N/A sys stdout write response N/A handle_get N/A N/A self N/A N/A N/A Handle a single HTTP GET request.

        Default implementation indicates an error because
        XML-RPC uses the POST method.
         N/A code 400 N/A N/A message explain N/A N/A N/A BaseHTTPServer BaseHTTPRequestHandler responses N/A code N/A response N/A N/A BaseHTTPServer DEFAULT_ERROR_MESSAGE N/A code message explain code message explain N/A N/A Status: %d %s N/A code message N/A Content-Type: text/html N/A N/A Content-Length: %d N/A len response N/A N/A N/A N/A N/A sys stdout write response N/A handle_request N/A N/A self request_text N/A None N/A N/A Handle a single XML-RPC request passed through a CGI post method.

        If no XML data is given then it is read from stdin. The resulting
        XML-RPC response is printed to stdout along with the correct HTTP
        headers.
         N/A N/A N/A request_text None N/A N/A N/A N/A os environ get REQUEST_METHOD None GET N/A N/A N/A N/A self handle_get N/A N/A N/A request_text None N/A N/A request_text N/A N/A N/A sys stdin read N/A N/A N/A self handle_xmlrpc request_text N/A N/A N/A N/A __name__ __main__ N/A N/A server N/A SimpleXMLRPCServer N/A localhost 8000 N/A N/A N/A server register_function pow N/A N/A N/A server register_function N/A N/A N/A x y N/A N/A x y add N/A N/A N/A server serve_forever