1
0
Fork 0
gnuviechadmin-historic/backend/xmlrpcservertest.py
Jan Dittberner 3c7d5d5ac7 - 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
2005-09-14 21:35:49 +00:00

26 lines
654 B
Python

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()