SimpleXMLRPCServer - client address

c james cjames at callone.net
Mon Apr 2 08:58:28 EDT 2007


Jan Danielsson wrote:
> Hello all,
> 
>    I writing an application based on the SimpleXMLRPCServer class. I
> would like to know the IP address of the client performing the RPC. Is
> that possible, without having to abandon the SimpleXMLRPCServer class?
> 
I did this a long time ago so it's not likely the best solution.

class RPCServer(SimpleXMLRPCServer):

     def _dispatch(self, method, params):
         """Extend dispatch, adding client info to some parameters."""
         if method in ({my list of methods I needed client address}):
             return SimpleXMLRPCServer._dispatch(self, method,
                                        params+(self.client_address,))
         return SimpleXMLRPCServer._dispatch(self, method, params);




More information about the Python-list mailing list