Update logging of python client

This commit is contained in:
geekerzp
2015-07-11 11:52:12 +08:00
parent 517717958d
commit 4d302683f3
12 changed files with 279 additions and 350 deletions

View File

@@ -130,23 +130,14 @@ class RESTClientObject(object):
headers=headers)
r = RESTResponse(r)
<<<<<<< HEAD
=======
# log response body
logger.debug("response body: %s" % r.data)
if r.status not in range(200, 206):
raise ApiException(r)
return self.process_response(r)
def process_response(self, response):
>>>>>>> Add logging and debug report for python client.
# In the python 3, the response.data is bytes.
# we need to decode it to string.
if sys.version_info > (3,):
r.data = r.data.decode('utf8')
# log response body
logger.debug("response body: %s" % r.data)
if r.status not in range(200, 206):
raise ApiException(http_resp=r)