[code.view]

[top] / python / PyMOTW / SimpleXMLRPCServer / SimpleXMLRPCServer_instance_dotted_names.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2008 Doug Hellmann All rights reserved.
     #
     """
     """
     
     __version__ = "$Id$"
     #end_pymotw_header
     
     from SimpleXMLRPCServer import SimpleXMLRPCServer
     import os
     import inspect
     
     server = SimpleXMLRPCServer(('localhost', 9000), logRequests=True)
     
     class ServiceRoot:
         pass
     
     class DirectoryService:
         def list(self, dir_name):
             return os.listdir(dir_name)
     
     root = ServiceRoot()
     root.dir = DirectoryService()
     
     server.register_instance(root, allow_dotted_names=True)
     
     try:
         print 'Use Control-C to exit'
         server.serve_forever()
     except KeyboardInterrupt:
         print 'Exiting'

[top] / python / PyMOTW / SimpleXMLRPCServer / SimpleXMLRPCServer_instance_dotted_names.py

contact | logmethods.com