Commit c4071978 authored by Petr Pudlak's avatar Petr Pudlak
Browse files

Add an RPC Python client for generated stub classes



The client provides _GenericInvoke(...) for a stub and uses its
_GetSocketPath() for opening a Transport.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent f952ed9f
......@@ -232,3 +232,26 @@ class AbstractClient(object):
" expected list, got %s" % type(args))
return CallRPCMethod(self._SendMethodCall, method, args,
version=self.version)
class AbstractStubClient(AbstractClient):
"""An abstract Client that connects a generated stub client to a L{Transport}.
Subclasses should inherit from this class (first) as well and a designated
stub (second).
"""
def __init__(self, timeouts=None, transport=t.Transport):
"""Constructor for the class.
Arguments are the same as for L{AbstractClient}. Checks that SOCKET_PATH
attribute is defined (in the stub class).
"""
super(AbstractStubClient, self).__init__(timeouts, transport)
def _GenericInvoke(self, method, *args):
return self.CallMethod(method, args)
def _GetAddress(self):
return self._GetSocketPath() # pylint: disable=E1101
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment