logging only error message instead of whole json reply

This commit is contained in:
aj 2019-08-10 17:54:25 +01:00
parent 0b68a45d50
commit 37328b8a58

View File

@ -24,7 +24,8 @@ class Network:
logger.debug(f'{method} get {req.status_code}') logger.debug(f'{method} get {req.status_code}')
return req.json() return req.json()
else: else:
logger.error(f'{method} get {req.status_code} {req.text}') error_text = req.json()['error']['message']
logger.error(f'{method} get {req.status_code} {error_text}')
return None return None
@ -38,7 +39,8 @@ class Network:
logger.debug(f'{method} post {req.status_code}') logger.debug(f'{method} post {req.status_code}')
return req return req
else: else:
logger.error(f'{method} post {req.status_code} {req.text}') error_text = req.json()['error']['message']
logger.error(f'{method} post {req.status_code} {error_text}')
return None return None
@ -52,7 +54,8 @@ class Network:
logger.debug(f'{method} put {req.status_code}') logger.debug(f'{method} put {req.status_code}')
return req return req
else: else:
logger.error(f'{method} put {req.status_code} {req.text}') error_text = req.json()['error']['message']
logger.error(f'{method} put {req.status_code} {error_text}')
return None return None