Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e486e0d

Browse files
committed
Preliminary documentation for the SimpleXMLRPCServer module.
1 parent abf925f commit e486e0d

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

Doc/lib/libsimplexmlrpc.tex

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
\section{\module{SimpleXMLRPCServer} ---
2+
Basic XML-RPC server}
3+
4+
\declaremodule{standard}{SimpleXMLRPCServer}
5+
\moduleauthor{Brian Quinlan}{[email protected]}
6+
\sectionauthor{Fred L. Drake, Jr.}{[email protected]}
7+
8+
9+
The \module{SimpleXMLRPCServer} module provides a basic server
10+
framework for XML-RPC servers written in Python. The server object is
11+
based on the \code{\refmodule{SocketServer}.TCPServer} class,
12+
and the request handler is based on the
13+
\code{\refmodule{BaseHTTPServer}.BaseHTTPRequestHandler} class.
14+
15+
16+
\begin{classdesc}{SimpleXMLRPCServer}{addr\optional{,
17+
requestHandler\optional{, logRequests}}}
18+
Create a new server instance. The \var{requestHandler} parameter
19+
should be a factory for request handler instances; it defaults to
20+
\class{SimpleXMLRPCRequestHandler}. The \var{addr} and
21+
\var{requestHandler} parameters are passed to the
22+
\class{\refmodule{SocketServer}.TCPServer} constructor. If
23+
\var{logRequests} is true (the default), requests will be logged;
24+
setting this parameter to false will turn off logging. This class
25+
provides methods for registration of functions that can be called by
26+
the XML-RPC protocol.
27+
\end{classdesc}
28+
29+
30+
\begin{classdesc}{SimpleXMLRPCRequestHandler}{}
31+
Create a new request handler instance. This request handler
32+
supports \code{POST} requests and modifies logging so that the
33+
\var{logRequests} parameter to the \class{SimpleXMLRPCServer}
34+
constructor parameter is honored.
35+
\end{classdesc}
36+
37+
38+
\subsection{SimpleXMLRPCServer Objects \label{simple-xmlrpc-servers}}
39+
40+
The \class{SimpleXMLRPCServer} class provides two methods that an
41+
application can use to register functions that can be called via the
42+
XML-RPC protocol via the request handler.
43+
44+
\begin{methoddesc}[SimpleXMLRPCServer]{register_function}{function\optional{,
45+
name}}
46+
Register a function that can respond to XML-RPC requests. The
47+
function must be callable with a single parameter which will be the
48+
return value of \function{\refmodule{xmlrpclib}.loads()} when called
49+
with the payload of the request. If \var{name} is given, it will be
50+
the method name associated with \var{function}, otherwise
51+
\code{\var{function}.__name__} will be used. \var{name} can be
52+
either a normal or Unicode string, and may contain characters not
53+
legal in Python identifiers, including the period character.
54+
\end{methoddesc}
55+
56+
\begin{methoddesc}[SimpleXMLRPCServer]{register_instance}{instance}
57+
Register an object which is used to expose method names which have
58+
not been registered using \method{register_function()}. If
59+
\var{instance} contains a \method{_dispatch()} method, it is called
60+
with the requested method name and the parameters from the request;
61+
the return value is returned to the client as the result. If
62+
\var{instance} does not have a \method{_dispatch()} method, it is
63+
searched for an attribute matching the name of the requested method;
64+
if the requested method name contains periods, each component of the
65+
method name is searched for individually, with the effect that a
66+
simple hierarchical search is performed. The value found from this
67+
search is then called with the parameters from the request, and the
68+
return value is passed back to the client.
69+
\end{methoddesc}

0 commit comments

Comments
 (0)