- 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:
parent
fa6961463e
commit
3c7d5d5ac7
1 changed files with 26 additions and 0 deletions
26
backend/xmlrpcservertest.py
Normal file
26
backend/xmlrpcservertest.py
Normal 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()
|
Loading…
Reference in a new issue