@cryptotaxi247 / netdata-1 / commits / 950b83383

fix style

Wing924 committed Feb 27, 2018 at 09:24 UTC 950b83383d08dff9f7df646c911b5885325f2d0b
1 file changed +19 -17
python.d/springboot.chart.py
+19 -17
@@ -76,7 +76,16 @@ class Service(UrlService):
76 Format data received from http request
77 :return: dict
78 """
79 - data = None
79 + raw_data = self._get_raw_data()
80 + if not raw_data:
81 + return None
82 +
83 + try:
84 + data = json.loads(raw_data)
85 + except ValueError:
86 + self.debug('%s is not a vaild JSON page' % self.url)
87 + return None
88 +
89 result = {
90 'resp_1xx': 0,
91 'resp_2xx': 0,
@@ -85,22 +94,15 @@ class Service(UrlService):
94 'resp_5xx': 0,
95 'resp_other': 0,
96 }
88 - raw_data = self._get_raw_data()
89 - if raw_data:
90 - try:
91 - data = json.loads(raw_data)
92 - except ValueError:
93 - self.debug('%s is not a vaild JSON page' % self.url)
94 - return None
95 -
96 - for key, value in data.iteritems():
97 - if 'counter.status.' in key:
98 - status_type = key[15:16] + 'xx'
99 - if status_type[0] not in '12345':
100 - status_type = 'other'
101 - result['resp_' + status_type] += value
102 - else:
103 - result[key.replace('.', '_')] = value
97 +
98 + for key, value in data.iteritems():
99 + if 'counter.status.' in key:
100 + status_type = key[15:16] + 'xx'
101 + if status_type[0] not in '12345':
102 + status_type = 'other'
103 + result['resp_' + status_type] += value
104 + else:
105 + result[key.replace('.', '_')] = value
106
107 return result or None
108