summaryrefslogtreecommitdiffstats
path: root/Lib/xmlrpc/server.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2014-01-13 00:07:59 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2014-01-13 00:07:59 (GMT)
commit95be7ff911536ad6c40b5ae47fca0d3492836832 (patch)
tree58fb02625bf5d6202ae157854a3aa10f34111240 /Lib/xmlrpc/server.py
parent8666e65206300b1719f4b2599939b7acf824b357 (diff)
parent939e2db48dc3bcb159486b599901b694d2d57f89 (diff)
downloadcpython-95be7ff911536ad6c40b5ae47fca0d3492836832.zip
cpython-95be7ff911536ad6c40b5ae47fca0d3492836832.tar.gz
cpython-95be7ff911536ad6c40b5ae47fca0d3492836832.tar.bz2
merge from 3.3
Issue #19082: Working xmlrpc.server and xmlrpc.client examples. Both in modules and in documentation.
Diffstat (limited to 'Lib/xmlrpc/server.py')
-rw-r--r--Lib/xmlrpc/server.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/xmlrpc/server.py b/Lib/xmlrpc/server.py
index d914282..304e218 100644
--- a/Lib/xmlrpc/server.py
+++ b/Lib/xmlrpc/server.py
@@ -960,10 +960,24 @@ class DocCGIXMLRPCRequestHandler( CGIXMLRPCRequestHandler,
if __name__ == '__main__':
+ import datetime
+
+ class ExampleService:
+ def getData(self):
+ return '42'
+
+ class currentTime:
+ @staticmethod
+ def getCurrentTime():
+ return datetime.datetime.now()
+
server = SimpleXMLRPCServer(("localhost", 8000))
server.register_function(pow)
server.register_function(lambda x,y: x+y, 'add')
+ server.register_instance(ExampleService(), allow_dotted_names=True)
+ server.register_multicall_functions()
print('Serving XML-RPC on localhost port 8000')
+ print('It is advisable to run this example server within a secure, closed network.')
try:
server.serve_forever()
except KeyboardInterrupt: