[Twisted-Python] Get IP of connecting client in XMLRPC server

Remy C. Cool dev-python at smartology.nl
Fri Jun 11 10:56:45 EDT 2004

On Friday 11 June 2004 16:35, Itamar Shtull-Trauring wrote:
> On Fri, 2004-06-11 at 09:34, Remy C. Cool wrote:
> > I'm currently in the process of changing from a customized
> > SimpleXMLRPCServer to a twisted XMLRPC server solution and I need
> > to insert the client IP into the attributes passed to the called
> > xmlrpc method. Anyone who knows the answer and is willing to
> > share the info?
> The render() method of the XMLRPC class has access to the request
> object, which may have request.getPeer() or
> request.transport.getPeer().

Thanks for the answer.

The following works, but is this a 'twisted' way to go?

class Examle(xmlrpc.XMLRPC):
    """An example object to be published."""
    def _getPeerAddress(self):
            return self.request.getClientIP()
    def render(self, request):
        self.request = request
        xmlrpc.XMLRPC.render(self, request)


More information about the Twisted-Python mailing list