DocXMLRPCServer
index
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/DocXMLRPCServer.py
Module Docs

Self documenting XML-RPC Server.
 
This module can be used to create XML-RPC servers that
serve pydoc-style documentation in response to HTTP
GET requests. This documentation is dynamically generated
based on the functions and methods registered with the
server.
 
This module is built upon the pydoc and SimpleXMLRPCServer
modules.

 
Modules
       
inspect
pydoc
re
sys

 
Classes
       
XMLRPCDocGenerator
DocCGIXMLRPCRequestHandler(SimpleXMLRPCServer.CGIXMLRPCRequestHandler, XMLRPCDocGenerator)
DocXMLRPCServer(SimpleXMLRPCServer.SimpleXMLRPCServer, XMLRPCDocGenerator)
SimpleXMLRPCServer.CGIXMLRPCRequestHandler(SimpleXMLRPCServer.SimpleXMLRPCDispatcher)
DocCGIXMLRPCRequestHandler(SimpleXMLRPCServer.CGIXMLRPCRequestHandler, XMLRPCDocGenerator)
SimpleXMLRPCServer.SimpleXMLRPCRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler)
DocXMLRPCRequestHandler
SimpleXMLRPCServer.SimpleXMLRPCServer(SocketServer.TCPServer, SimpleXMLRPCServer.SimpleXMLRPCDispatcher)
DocXMLRPCServer(SimpleXMLRPCServer.SimpleXMLRPCServer, XMLRPCDocGenerator)
pydoc.HTMLDoc(pydoc.Doc)
ServerHTMLDoc

 
class DocCGIXMLRPCRequestHandler(SimpleXMLRPCServer.CGIXMLRPCRequestHandler, XMLRPCDocGenerator)
    Handler for XML-RPC data and documentation requests passed through
CGI
 
 
Method resolution order:
DocCGIXMLRPCRequestHandler
SimpleXMLRPCServer.CGIXMLRPCRequestHandler
SimpleXMLRPCServer.SimpleXMLRPCDispatcher
XMLRPCDocGenerator

Methods defined here:
__init__(self)
handle_get(self)
Handles the HTTP GET request.
 
Interpret all HTTP GET requests as requests for server
documentation.

Methods inherited from SimpleXMLRPCServer.CGIXMLRPCRequestHandler:
handle_request(self, request_text=None)
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.
handle_xmlrpc(self, request_text)
Handle a single XML-RPC request

Methods inherited from SimpleXMLRPCServer.SimpleXMLRPCDispatcher:
register_function(self, function, name=None)
Registers a function to respond to XML-RPC requests.
 
The optional name argument can be used to set a Unicode name
for the function.
register_instance(self, instance, allow_dotted_names=False)
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.
register_introspection_functions(self)
Registers the XML-RPC introspection methods in the system
namespace.
 
see http://xmlrpc.usefulinc.com/doc/reserved.html
register_multicall_functions(self)
Registers the XML-RPC multicall method in the system
namespace.
 
see http://www.xmlrpc.com/discuss/msgReader$1208
system_listMethods(self)
system.listMethods() => ['add', 'subtract', 'multiple']
 
Returns a list of the methods supported by the server.
system_methodHelp(self, method_name)
system.methodHelp('add') => "Adds two integers together"
 
Returns a string containing documentation for the specified method.
system_methodSignature(self, method_name)
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.
system_multicall(self, call_list)
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

Methods inherited from XMLRPCDocGenerator:
generate_html_documentation(self)
generate_html_documentation() => html documentation for the server
 
Generates HTML documentation for the server using introspection for
installed functions and instances that do not implement the
_dispatch method. Alternatively, instances can choose to implement
the _get_method_argstring(method_name) method to provide the
argument string used in the documentation and the
_methodHelp(method_name) method to provide the help text used
in the documentation.
set_server_documentation(self, server_documentation)
Set the documentation string for the entire server.
set_server_name(self, server_name)
Set the name of the generated HTML server documentation
set_server_title(self, server_title)
Set the HTML title of the generated server documentation

 
class DocXMLRPCRequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHandler)
    XML-RPC and documentation request handler class.
 
Handles all HTTP POST requests and attempts to decode them as
XML-RPC requests.
 
Handles all HTTP GET requests and interprets them as requests
for documentation.
 
 
Method resolution order:
DocXMLRPCRequestHandler
SimpleXMLRPCServer.SimpleXMLRPCRequestHandler
BaseHTTPServer.BaseHTTPRequestHandler
SocketServer.StreamRequestHandler
SocketServer.BaseRequestHandler

Methods defined here:
do_GET(self)
Handles the HTTP GET request.
 
Interpret all HTTP GET requests as requests for server
documentation.

Methods inherited from SimpleXMLRPCServer.SimpleXMLRPCRequestHandler:
accept_encodings(self)
decode_request_content(self, data)
do_POST(self)
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.
is_rpc_path_valid(self)
log_request(self, code='-', size='-')
Selectively log an accepted request.
report_404(self)

Data and other attributes inherited from SimpleXMLRPCServer.SimpleXMLRPCRequestHandler:
aepattern = <_sre.SRE_Pattern object>
disable_nagle_algorithm = True
encode_threshold = 1400
rpc_paths = ('/', '/RPC2')
wbufsize = -1

Methods inherited from BaseHTTPServer.BaseHTTPRequestHandler:
address_string(self)
Return the client address formatted for logging.
 
This version looks up the full hostname using gethostbyaddr(),
and tries to find a name that contains at least one dot.
date_time_string(self, timestamp=None)
Return the current date and time formatted for a message header.
end_headers(self)
Send the blank line ending the MIME headers.
handle(self)
Handle multiple requests if necessary.
handle_one_request(self)
Handle a single HTTP request.
 
You normally don't need to override this method; see the class
__doc__ string for information on how to handle specific HTTP
commands such as GET and POST.
log_date_time_string(self)
Return the current time formatted for logging.
log_error(self, format, *args)
Log an error.
 
This is called when a request cannot be fulfilled.  By
default it passes the message on to log_message().
 
Arguments are the same as for log_message().
 
XXX This should go to the separate error log.
log_message(self, format, *args)
Log an arbitrary message.
 
This is used by all other logging functions.  Override
it if you have specific logging wishes.
 
The first argument, FORMAT, is a format string for the
message to be logged.  If the format string contains
any % escapes requiring parameters, they should be
specified as subsequent arguments (it's just like
printf!).
 
The client ip address and current date/time are prefixed to every
message.
parse_request(self)
Parse a request (internal).
 
The request should be stored in self.raw_requestline; the results
are in self.command, self.path, self.request_version and
self.headers.
 
Return True for success, False for failure; on failure, an
error is sent back.
send_error(self, code, message=None)
Send and log an error reply.
 
Arguments are the error code, and a detailed message.
The detailed message defaults to the short entry matching the
response code.
 
This sends an error response (so it must be called before any
output has been generated), logs the error, and finally sends
a piece of HTML explaining the error to the user.
send_header(self, keyword, value)
Send a MIME header.
send_response(self, code, message=None)
Send the response header and log the response code.
 
Also send two standard headers with the server software
version and the current date.
version_string(self)
Return the server software version string.

Data and other attributes inherited from BaseHTTPServer.BaseHTTPRequestHandler:
MessageClass = <class mimetools.Message>
default_request_version = 'HTTP/0.9'
error_content_type = 'text/html'
error_message_format = '<head>\n<title>Error response</title>\n</head>\n<bo...ode explanation: %(code)s = %(explain)s.\n</body>\n'
monthname = [None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
protocol_version = 'HTTP/1.0'
responses = {100: ('Continue', 'Request received, please continue'), 101: ('Switching Protocols', 'Switching to new protocol; obey Upgrade header'), 200: ('OK', 'Request fulfilled, document follows'), 201: ('Created', 'Document created, URL follows'), 202: ('Accepted', 'Request accepted, processing continues off-line'), 203: ('Non-Authoritative Information', 'Request fulfilled from cache'), 204: ('No Content', 'Request fulfilled, nothing follows'), 205: ('Reset Content', 'Clear input form for further input.'), 206: ('Partial Content', 'Partial content follows.'), 300: ('Multiple Choices', 'Object has several resources -- see URI list'), ...}
server_version = 'BaseHTTP/0.3'
sys_version = 'Python/2.7.10'
weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']

Methods inherited from SocketServer.StreamRequestHandler:
finish(self)
setup(self)

Data and other attributes inherited from SocketServer.StreamRequestHandler:
rbufsize = -1
timeout = None

Methods inherited from SocketServer.BaseRequestHandler:
__init__(self, request, client_address, server)

 
class DocXMLRPCServer(SimpleXMLRPCServer.SimpleXMLRPCServer, XMLRPCDocGenerator)
    XML-RPC and HTML documentation server.
 
Adds the ability to serve server documentation to the capabilities
of SimpleXMLRPCServer.
 
 
Method resolution order:
DocXMLRPCServer
SimpleXMLRPCServer.SimpleXMLRPCServer
SocketServer.TCPServer
SocketServer.BaseServer
SimpleXMLRPCServer.SimpleXMLRPCDispatcher
XMLRPCDocGenerator

Methods defined here:
__init__(self, addr, requestHandler=<class DocXMLRPCServer.DocXMLRPCRequestHandler>, logRequests=1, allow_none=False, encoding=None, bind_and_activate=True)

Data and other attributes inherited from SimpleXMLRPCServer.SimpleXMLRPCServer:
allow_reuse_address = True

Methods inherited from SocketServer.TCPServer:
close_request(self, request)
Called to clean up an individual request.
fileno(self)
Return socket file number.
 
Interface required by select().
get_request(self)
Get the request and client address from the socket.
 
May be overridden.
server_activate(self)
Called by constructor to activate the server.
 
May be overridden.
server_bind(self)
Called by constructor to bind the socket.
 
May be overridden.
server_close(self)
Called to clean-up the server.
 
May be overridden.
shutdown_request(self, request)
Called to shutdown and close an individual request.

Data and other attributes inherited from SocketServer.TCPServer:
address_family = 2
request_queue_size = 5
socket_type = 1

Methods inherited from SocketServer.BaseServer:
finish_request(self, request, client_address)
Finish one request by instantiating RequestHandlerClass.
handle_error(self, request, client_address)
Handle an error gracefully.  May be overridden.
 
The default is to print a traceback and continue.
handle_request(self)
Handle one request, possibly blocking.
 
Respects self.timeout.
handle_timeout(self)
Called if no new request arrives within self.timeout.
 
Overridden by ForkingMixIn.
process_request(self, request, client_address)
Call finish_request.
 
Overridden by ForkingMixIn and ThreadingMixIn.
serve_forever(self, poll_interval=0.5)
Handle one request at a time until shutdown.
 
Polls for shutdown every poll_interval seconds. Ignores
self.timeout. If you need to do periodic tasks, do them in
another thread.
shutdown(self)
Stops the serve_forever loop.
 
Blocks until the loop has finished. This must be called while
serve_forever() is running in another thread, or it will
deadlock.
verify_request(self, request, client_address)
Verify the request.  May be overridden.
 
Return True if we should proceed with this request.

Data and other attributes inherited from SocketServer.BaseServer:
timeout = None

Methods inherited from SimpleXMLRPCServer.SimpleXMLRPCDispatcher:
register_function(self, function, name=None)
Registers a function to respond to XML-RPC requests.
 
The optional name argument can be used to set a Unicode name
for the function.
register_instance(self, instance, allow_dotted_names=False)
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.
register_introspection_functions(self)
Registers the XML-RPC introspection methods in the system
namespace.
 
see http://xmlrpc.usefulinc.com/doc/reserved.html
register_multicall_functions(self)
Registers the XML-RPC multicall method in the system
namespace.
 
see http://www.xmlrpc.com/discuss/msgReader$1208
system_listMethods(self)
system.listMethods() => ['add', 'subtract', 'multiple']
 
Returns a list of the methods supported by the server.
system_methodHelp(self, method_name)
system.methodHelp('add') => "Adds two integers together"
 
Returns a string containing documentation for the specified method.
system_methodSignature(self, method_name)
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.
system_multicall(self, call_list)
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

Methods inherited from XMLRPCDocGenerator:
generate_html_documentation(self)
generate_html_documentation() => html documentation for the server
 
Generates HTML documentation for the server using introspection for
installed functions and instances that do not implement the
_dispatch method. Alternatively, instances can choose to implement
the _get_method_argstring(method_name) method to provide the
argument string used in the documentation and the
_methodHelp(method_name) method to provide the help text used
in the documentation.
set_server_documentation(self, server_documentation)
Set the documentation string for the entire server.
set_server_name(self, server_name)
Set the name of the generated HTML server documentation
set_server_title(self, server_title)
Set the HTML title of the generated server documentation

 
class ServerHTMLDoc(pydoc.HTMLDoc)
    Class used to generate pydoc HTML document for a server
 
 
Method resolution order:
ServerHTMLDoc
pydoc.HTMLDoc
pydoc.Doc

Methods defined here:
docroutine(self, object, name, mod=None, funcs={}, classes={}, methods={}, cl=None)
Produce HTML documentation for a function or method object.
docserver(self, server_name, package_documentation, methods)
Produce HTML documentation for an XML-RPC server.
markup(self, text, escape=None, funcs={}, classes={}, methods={})
Mark up some plain text, given a context of symbols to look for.
Each context dictionary maps object names to anchor names.

Methods inherited from pydoc.HTMLDoc:
bigsection(self, title, *args)
Format a section with a big heading.
classlink(self, object, modname)
Make a link for a class.
docclass(self, object, name=None, mod=None, funcs={}, classes={}, *ignored)
Produce HTML documentation for a class object.
docdata(self, object, name=None, mod=None, cl=None)
Produce html documentation for a data descriptor.
docmodule(self, object, name=None, mod=None, *ignored)
Produce HTML documentation for a module object.
docother(self, object, name=None, mod=None, *ignored)
Produce HTML documentation for a data object.
docproperty(self, object, name=None, mod=None, cl=None)
Produce html documentation for a property.
escape(self, text) from pydoc.HTMLRepr
formattree(self, tree, modname, parent=None)
Produce HTML for a class tree as given by inspect.getclasstree().
formatvalue(self, object)
Format an argument default value as text.
grey(self, text)
heading(self, title, fgcol, bgcol, extras='')
Format a page heading.
index(self, dir, shadowed=None)
Generate an HTML index for a directory of modules.
modpkglink(self, data)
Make a link for a module or package to display in an index.
modulelink(self, object)
Make a link for a module.
multicolumn(self, list, format, cols=4)
Format a list of items into a multi-column list.
namelink(self, name, *dicts)
Make a link for an identifier, given name-to-URL mappings.
page(self, title, contents)
Format an HTML page.
preformat(self, text)
Format literal preformatted text.
repr(self, object) from pydoc.HTMLRepr
section(self, title, fgcol, bgcol, contents, width=6, prelude='', marginalia=None, gap='&nbsp;')
Format a section with a heading.

Methods inherited from pydoc.Doc:
document(self, object, name=None, *args)
Generate documentation for an object.
fail(self, object, name=None, *args)
Raise an exception for unimplemented types.
getdocloc(self, object)
Return the location of module docs or None

 
class XMLRPCDocGenerator
    Generates documentation for an XML-RPC server.
 
This class is designed as mix-in and should not
be constructed directly.
 
  Methods defined here:
__init__(self)
generate_html_documentation(self)
generate_html_documentation() => html documentation for the server
 
Generates HTML documentation for the server using introspection for
installed functions and instances that do not implement the
_dispatch method. Alternatively, instances can choose to implement
the _get_method_argstring(method_name) method to provide the
argument string used in the documentation and the
_methodHelp(method_name) method to provide the help text used
in the documentation.
set_server_documentation(self, server_documentation)
Set the documentation string for the entire server.
set_server_name(self, server_name)
Set the name of the generated HTML server documentation
set_server_title(self, server_title)
Set the HTML title of the generated server documentation