"retroshare" module update
lgz committed
Oct 14, 2017 at 21:59 UTC
50b2fbff8554197e6190fc098decd4687d12e26b
1 file changed
+4
-6
python.d/retroshare.chart.py
+4
-6
@@ -2,9 +2,10 @@
2
# Description: RetroShare netdata python.d module
3
# Authors: sehraf
4
5
-from base import UrlService
5
import json
6
7
+from bases.FrameworkServices.UrlService import UrlService
8
+
9
# default module values (can be overridden per job in `config`)
10
# update_every = 2
11
priority = 60000
@@ -38,10 +39,7 @@ CHARTS = {
39
class Service(UrlService):
40
def __init__(self, configuration=None, name=None):
41
UrlService.__init__(self, configuration=configuration, name=name)
41
- try:
42
- self.baseurl = str(self.configuration['url'])
43
- except (KeyError, TypeError):
44
- self.baseurl = 'http://localhost:9090'
42
+ self.baseurl = self.configuration.get('url', 'http://localhost:9090')
43
self.order = ORDER
44
self.definitions = CHARTS
45
@@ -55,7 +53,7 @@ class Service(UrlService):
53
parsed = json.loads(raw)
54
if str(parsed['returncode']) != 'ok':
55
return None
58
- except:
56
+ except (TypeError, ValueError):
57
return None
58
59
return parsed['data'][0]