@cryptotaxi247 / netdata-1 / commits / 99e1b1e1d

UrlService request timeout can be specified in the configuration file

lgz committed Oct 22, 2017 at 06:04 UTC 99e1b1e1d62df89649cbc41711fef01ad9523f78
1 file changed +2 -2
python.d/python_modules/bases/FrameworkServices/UrlService.py
+2 -2
@@ -23,6 +23,7 @@ class UrlService(SimpleService):
23 self.proxy_password = self.configuration.get('proxy_pass')
24 self.proxy_url = self.configuration.get('proxy_url')
25 self.header = self.configuration.get('header')
26 + self.request_timeout = self.configuration.get('timeout', 1)
27 self._manager = None
28
29 def __make_headers(self, **header_kw):
@@ -73,10 +74,9 @@ class UrlService(SimpleService):
74 try:
75 url = url or self.url
76 manager = manager or self._manager
76 - # TODO: timeout, retries and method hardcoded..
77 response = manager.request(method='GET',
78 url=url,
79 - timeout=1,
79 + timeout=self.request_timeout,
80 retries=1,
81 headers=manager.headers)
82 except (urllib3.exceptions.HTTPError, TypeError, AttributeError) as error: