[Twisted-Python] XMLRPC getting calling host

Wari Wahab wari at home.wari.org
Wed May 28 00:46:18 EDT 2003

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.

More information about the Twisted-Python mailing list