summaryrefslogtreecommitdiffstats
path: root/testapi/testapi-client/testapiclient/command.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2018-03-09 15:53:12 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2018-03-09 16:18:25 +0800
commitcc29ae1cd41d1f403511730d5ba44dded967fb12 (patch)
tree6a0f09182398f7e4fe3cbabd199f30937f0ede0a /testapi/testapi-client/testapiclient/command.py
parentc9d24c5253c0ba3e09151c880cdb8c16e145ea60 (diff)
unify message prompt
Change-Id: I31a10c0aa92a72fdbd76475e6f618f63fef9b925 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'testapi/testapi-client/testapiclient/command.py')
-rw-r--r--testapi/testapi-client/testapiclient/command.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/testapi/testapi-client/testapiclient/command.py b/testapi/testapi-client/testapiclient/command.py
index 2864f9a..62a8b86 100644
--- a/testapi/testapi-client/testapiclient/command.py
+++ b/testapi/testapi-client/testapiclient/command.py
@@ -14,6 +14,11 @@ class Command(command.Command):
return parser
+ def show(self, request, response):
+ print ' '.join([request,
+ 'success' if response.status_code < 300
+ else 'failed: {}'.format(response.text)])
+
class Lister(command.Command):
@@ -24,6 +29,10 @@ class Lister(command.Command):
return query_url() if parsed_args.name else url
+ def show(self, response):
+ print response.json() if response.status_code < 300 else response.text
+
class ShowOne(command.Command):
- pass
+ def show(self, response):
+ print response.json() if response.status_code < 300 else response.text