SimpleXMLRPCServer and client address

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Feb 11 06:37:17 CET 2010


En Wed, 10 Feb 2010 19:19:50 -0300, Jordan Apgar <twistedphrame at gmail.com>  
escribió:

> I'm trying to right a server that needs specific information for each
> client accessing it.  The easiest way I could think of doing this is
> keeping this information based on ip address (the information is only
> valid for a short time).  I know there is no was to get the client's
> address directly and have seen a few examples of subclassing the
> SimpleXMLRPCServer like this:
>
> 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);
>
>
> but to be honest I don't understand what's going on there or how to
> use it.  Would anyone be able to explain this to me?

Do you want an explanation of what the above code does?

-- 
Gabriel Genellina




More information about the Python-list mailing list