From 28b92135484db29c51b7ba0a3bfd2f274ef011b1 Mon Sep 17 00:00:00 2001 From: tengqm Date: Fri, 16 Jan 2015 15:06:31 +0800 Subject: [PATCH] Revised common client to use session The previous version was using an endpoint. With sessions we may be able to provide a Shell like environment without having to create connections each time. --- senlinclient/client.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/senlinclient/client.py b/senlinclient/client.py index 647b36d..ac6a6cb 100644 --- a/senlinclient/client.py +++ b/senlinclient/client.py @@ -13,7 +13,12 @@ from senlinclient.common import utils -def Client(version, *args, **kwargs): - module = utils.import_versioned_module(version, 'client') - client_class = getattr(module, 'Client') - return client_class(*args, **kwargs) +def Client(api_ver, session, **kwargs): + '''Import versioned client module. + + :param api_ver: API version required. + :param endpoint: endpoint URL requested. + ''' + module = utils.import_versioned_module(api_ver, 'client') + cls = getattr(module, 'Client') + return cls(session)