I have a SimpleXMLRPCServer server (Python).
How can I get the IP address of the client in the request handler?
This information appears in the log. However, I am not sure how to access this information from within the request handler.
I have a SimpleXMLRPCServer server (Python).
How can I get the IP address of the client in the request handler?
This information appears in the log. However, I am not sure how to access this information from within the request handler.
The request handler itself should have a property
client_address
(inherited fromBaseHTTPRequestHandler
). From BaseHTTPRequestHandler:One way to pass the ip address to the request method is to override RequestHandler.decode_request_content.
decode_request_content returns a XML string. Example:
Just slip another parameter in there.
and update your method signatures accordingly.
As Michael noted, you can get
client_address
from within the request handler. For instance, you can override the__init__
function which is inherited indirectly fromBaseRequestHandler
.