SimpleRPCServer
Skip Montanaro
skip at pobox.com
Fri Mar 25 08:13:06 EST 2005
Esben> What i don't know is how to the client ip. I would think I should
Esben> override the _marshalled_dispatch method but I can't quite grasp
Esben> it all.
First, from my reading of SimpleXMLRPCServer, I don't think _dispatch()
belongs at that level. It belongs in the request handler class or in a
separate dispatcher class, depending on what version of Python you're using.
Second, SimpleXMLRPCServer is a SocketServer subclass. You should be able
to provide a verify_request method (see the SocketServer docs) and a handler
class with a set_local method:
class RPCServer(SimpleXMLRPCServer):
def verify_request(self, handler, address):
handler.set_local(address_is_local(address))
A _dispatch method in the handler will then be able to check an attribute to
know if the request was made from the local machine or not.
Skip
More information about the Python-list
mailing list