XML-RPC

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python
import SimpleXMLRPCServer
import os
def ls(directory):
try:
return os.listdir(directory)
except OSError:
return[]
def ls_boom(directory):
return os.listdir(directory)
def cb(obj):
print "OBJECT::", obj
print "OBJECT.__class__::", obj.__class__
return obj.cb()
if __name__ == '__main__':
s=SimpleXMLRPCServer.SimpleXMLRPCServer(('127.0.0.1', 8765))
s.register_function(ls)
s.register_function(ls_boom)
s.register_function(cb)
s.serve_forever()