[Twisted-Python] XMLRPC getting calling host
![](https://secure.gravatar.com/avatar/268fc4cae6d0ea29d17191428c4d7f1e.jpg?s=120&d=mm&r=g)
Hey there! Just a little try to check whether I'm still subscribed to twisted, as today's other posts regarding the safe pickling never got through, somehow... I've come to the point where I need to query the IP an XMLRPC request came from. In UDP, you get it served when the call to datagramReceived comes through, but I've not seen any attribute of the XMLRPC class, or of the underlying Resource class which states anything about how to get this attribute. Is it possible? And if, how? Thanks! Heiko.
![](https://secure.gravatar.com/avatar/8ab170b9b306906ab29f527a89806ff5.jpg?s=120&d=mm&r=g)
Heiko Wundram wrote:
I've come to the point where I need to query the IP an XMLRPC request came from. In UDP, you get it served when the call to datagramReceived comes through, but I've not seen any attribute of the XMLRPC class, or of the underlying Resource class which states anything about how to get this attribute. Is it possible? And if, how?
Just a stab in the dark here, but I believe it's possible to override the render method to get this information via the request parameter. Something like: from twisted.web import xmlrpc class MyXmlRpcHandler(xmlrpc.XMLRPC): def render(self, request): self._ip = request.something # Get IP information here xmlrpc.XMLRPC.render(self, request) def xmlrpc_method(self, *args): # You can now use self._ip for this instance of MyXmlRpcHandler Sorry for my lack of knowledge in the request object object, but every known html info about the request is available there.
![](https://secure.gravatar.com/avatar/b3407ff6ccd34c6e7c7a9fdcfba67a45.jpg?s=120&d=mm&r=g)
On Wed, May 28, 2003 at 06:22:16AM +0200, Heiko Wundram wrote:
I've come to the point where I need to query the IP an XMLRPC request came from. In UDP, you get it served when the call to datagramReceived comes through, but I've not seen any attribute of the XMLRPC class, or of the underlying Resource class which states anything about how to get this attribute. Is it possible? And if, how?
Request objects have a .getClientIP method. -Andrew.
participants (3)
-
Andrew Bennetts
-
Heiko Wundram
-
Wari Wahab