I am implementing an application using XML-RPC, and would like to be able to differentiate between multiple clients. The best way to do this that I could think of would be to simply pass some unique identifier along with each call over XML-RPC. However, this could get to be a bit cumbersome, and I'd rather not have to worry about it after setting it once (the unique ID on the client-side, that is).

In my particular situation, all of the exposed functions are actually methods of a class that inherits from SimpleXMLRPCServer (just to keep things nice and simple).

Example:
class X(SimpleXMLRPCServer:
  def someMethod(self, uniqID, someVal):
    ...
    return foo

I would like to create a similar wrapper for xmlrpclib.ServerProxy that automatically fills the 'uniqID' field with each call over XMLRPC.

For example, instead of
conn = ServerProxy(someURL)
conn.someMethod(myUniqID, blah)

I would like to be able to do the following...
conn = ServerProxyWrapper(someURL)
conn.setUniqID(myUniqID)
conn.someMethod(blah)

How would I go about implementing this?

Thanks,
Zach
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to