From 37328b8a58838da30cfbaaade447317a5ae1aed4 Mon Sep 17 00:00:00 2001 From: aj Date: Sat, 10 Aug 2019 17:54:25 +0100 Subject: [PATCH] logging only error message instead of whole json reply --- spotframework/net/network.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spotframework/net/network.py b/spotframework/net/network.py index 5b36c6d..7975178 100644 --- a/spotframework/net/network.py +++ b/spotframework/net/network.py @@ -24,7 +24,8 @@ class Network: logger.debug(f'{method} get {req.status_code}') return req.json() 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 @@ -38,7 +39,8 @@ class Network: logger.debug(f'{method} post {req.status_code}') return req 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 @@ -52,7 +54,8 @@ class Network: logger.debug(f'{method} put {req.status_code}') return req 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