luigipaioro at libero.it
Tue Sep 9 17:53:57 CEST 2008
I'm writing an XML-RPC server which should be able to modify the
incoming request before dispatching it. In particular I wand to added
two fixed parameters to the method called: one is the client host
address, and the other is the user name provided as for Basic
To do this, at the present I've overwritten the do_POST method of
SimpleXMLRPCRequestHandler, including at a certain point this code:
data = ''.join(L)
params, method = xmlrpclib.loads(data)
user = "unknown"
# handle Basic authentication
(enctype, encstr) = self.headers.get('Authorization').split()
user, password = base64.standard_b64decode(encstr).split(':')
params = list(params)
params = tuple(params)
data = xmlrpclib.dumps(params, methodname=method)
(I slightly modified it to make it more readable at mail level)
It works, but I don't really like it because it completely overwrites
the do_POST method that in the future Python releases is going to
change (I verified it). Do you know a better way to do this?
Thanks in advance.
More information about the Python-list