remove long html show when service unavailable 87/53387/2
authorSerenaFeng <feng.xiaowei@zte.com.cn>
Fri, 9 Mar 2018 10:03:30 +0000 (18:03 +0800)
committerSerena Feng <feng.xiaowei@zte.com.cn>
Fri, 9 Mar 2018 10:01:41 +0000 (10:01 +0000)
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>
testapi/testapi-client/testapiclient/utils/command.py

index 95f1fb0..f9c75a7 100644 (file)
@@ -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)