[Twisted-Python] How to get the IP address of a client using XML-RPC
Jp Calderone
exarkun at divmod.com
Tue May 18 19:25:46 MDT 2004
Daniel Newton wrote:
>
> I have a simple XML-PRC server similar to the example below:
>
> from twisted.web import xmlrpc, server
>
> class Example(xmlrpc.XMLRPC):
> """An example object to be published."""
>
> def xmlrpc_add(self, a, b):
> """Return sum of arguments."""
> return a + b
def xmlrpc_whatIsMyAddress(self):
return self.transport.getPeer().host
>
> if __name__ == '__main__':
> from twisted.internet import reactor
> r = Example()
> reactor.listenTCP(7080, server.Site(r))
> reactor.run()
>
> I want to be able to get the address of the client that calls the xmlrpc
> method can anyone help me with this?
>
> thanks in advance
>
> Daniel Newton
>
Jp
More information about the Twisted-Python
mailing list