diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2018-03-09 18:03:30 +0800 |
---|---|---|
committer | Serena Feng <feng.xiaowei@zte.com.cn> | 2018-03-09 10:01:41 +0000 |
commit | b9a37f073add2727be592d8fa994efa73772263b (patch) | |
tree | ec277cc8ec5e2af352676fd91fc658a73e8f8027 /testapi/testapi-client | |
parent | 1a95c1e6b33d9b3efcfd92e1de64feee7e9b5c68 (diff) |
remove long html show when service unavailable
long message:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta http-equiv="Content-Type" CONTENT="text/html; charset=utf-8">
<title>ERROR: The requested URL could not be retrieved</title>
<style type="text/css"><!--
Change-Id: I1f5495b20328a7a23462ce66813b1ecc2082822b
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'testapi/testapi-client')
-rw-r--r-- | testapi/testapi-client/testapiclient/utils/command.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/testapi/testapi-client/testapiclient/utils/command.py b/testapi/testapi-client/testapiclient/utils/command.py index 95f1fb0..f9c75a7 100644 --- a/testapi/testapi-client/testapiclient/utils/command.py +++ b/testapi/testapi-client/testapiclient/utils/command.py @@ -18,7 +18,7 @@ class Command(command.Command): def show(self, request, response): print ' '.join([request, 'success' if response.status_code < 300 - else 'failed: {}'.format(response.text)]) + else 'failed: {}'.format(response.reason)]) class Lister(command.Command): @@ -31,9 +31,11 @@ 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 + print response.json() if response.status_code < 300 \ + else 'Get failed: {}'.format(response.reason) class ShowOne(command.Command): def show(self, response): - print response.json() if response.status_code < 300 else response.text + print response.json() if response.status_code < 300 \ + else 'Get failed: {}'.format(response.reason) |