diff options
author | thuva4 <tharma.thuva@gmail.com> | 2018-01-30 19:50:33 +0530 |
---|---|---|
committer | thuva4 <tharma.thuva@gmail.com> | 2018-02-08 14:55:43 +0530 |
commit | c53fc432fc7ddf004d4e1eea9bd407f3c548908d (patch) | |
tree | 89a24a0e1432951194a89797deb58c825f4d4336 /testapi/testapi-client/testapiclient/main.py | |
parent | bd2e91686de6bc61b97ac66af47f830d1c82786a (diff) |
create Testapi client
implement auth in testapi client
implement pods in testapi client
Change-Id: Idd5c9dcf938ad5994e655b55d49625ab462ab710
Signed-off-by: thuva4 <tharma.thuva@gmail.com>
Diffstat (limited to 'testapi/testapi-client/testapiclient/main.py')
-rw-r--r-- | testapi/testapi-client/testapiclient/main.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/testapi/testapi-client/testapiclient/main.py b/testapi/testapi-client/testapiclient/main.py new file mode 100644 index 0000000..07dbeb8 --- /dev/null +++ b/testapi/testapi-client/testapiclient/main.py @@ -0,0 +1,40 @@ +import sys +import requests +from user import User +from config import Config +from cliff.app import App +from cliff.commandmanager import CommandManager + + +class TestAPIClient(App): + + def __init__(self): + super(TestAPIClient, self).__init__( + description='TestAPI Client', + version='0.1', + command_manager=CommandManager('testapi'), + deferred_help=True, + ) + User.session = requests.Session() + # Configure development or Production mode + Config.parse_conf() + + def initialize_app(self, argv): + self.LOG.debug('initialize_app') + + def prepare_to_run_command(self, cmd): + self.LOG.debug('prepare_to_run_command %s', cmd.__class__.__name__) + + def clean_up(self, cmd, result, err): + self.LOG.debug('clean_up %s', cmd.__class__.__name__) + if err: + self.LOG.debug('got an error: %s', err) + + +def main(argv=sys.argv[1:]): + myapp = TestAPIClient() + return myapp.run(argv) + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) |