1
0
Fork 0

- start of a simple XML RPC Server

git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@99 a67ec6bc-e5d5-0310-a910-815c51eb3124
This commit is contained in:
Jan Dittberner 2005-09-14 21:35:49 +00:00
parent fa6961463e
commit 3c7d5d5ac7

View file

@ -0,0 +1,26 @@
from DocXMLRPCServer import DocXMLRPCServer
import traceback
import pwd
class TestService:
def listUsers(self):
"""Lists all system users."""
entries = [":".join((item[0], str(item[2]), str(item[3]), item[4])) for item in pwd.getpwall() if item[0].find("usr")==0]
return "\n".join(entries)
def startRPCServer():
server = DocXMLRPCServer(("localhost", 8080))
server.register_introspection_functions()
server.register_instance(TestService())
try:
server.serve_forever()
except KeyboardInterrupt:
server.server_close()
if __name__ == "__main__":
service = TestService()
print service.listUsers()
startRPCServer()