diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-05-21 18:55:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-05-21 18:55:22 +0000 |
commit | 61d0027904ee9c040985b1642ca228737d616d03 (patch) | |
tree | c90838c137b4dc4a2de1cff9f2d7be5552d605e7 /collectors/python.d.plugin/python_modules/bases/FrameworkServices/UrlService.py | |
parent | Adding upstream version 1.14.0. (diff) | |
download | netdata-61d0027904ee9c040985b1642ca228737d616d03.tar.xz netdata-61d0027904ee9c040985b1642ca228737d616d03.zip |
Adding upstream version 1.15.0.upstream/1.15.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/python.d.plugin/python_modules/bases/FrameworkServices/UrlService.py')
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/FrameworkServices/UrlService.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/collectors/python.d.plugin/python_modules/bases/FrameworkServices/UrlService.py b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/UrlService.py index 1e87c9948..439456655 100644 --- a/collectors/python.d.plugin/python_modules/bases/FrameworkServices/UrlService.py +++ b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/UrlService.py @@ -88,14 +88,14 @@ class UrlService(SimpleService): self.error('build_manager() error:', str(error)) return None - def _get_raw_data(self, url=None, manager=None): + def _get_raw_data(self, url=None, manager=None, **kwargs): """ Get raw data from http request :return: str """ try: - status, data = self._get_raw_data_with_status(url, manager) - except (urllib3.exceptions.HTTPError, TypeError, AttributeError) as error: + status, data = self._get_raw_data_with_status(url, manager, **kwargs) + except Exception as error: self.error('Url: {url}. Error: {error}'.format(url=url or self.url, error=error)) return None @@ -105,7 +105,7 @@ class UrlService(SimpleService): self.debug('Url: {url}. Http response status code: {code}'.format(url=url or self.url, code=status)) return None - def _get_raw_data_with_status(self, url=None, manager=None, retries=1, redirect=True): + def _get_raw_data_with_status(self, url=None, manager=None, retries=1, redirect=True, **kwargs): """ Get status and response body content from http request. Does not catch exceptions :return: int, str @@ -123,6 +123,7 @@ class UrlService(SimpleService): retries=retry, headers=manager.headers, redirect=redirect, + **kwargs ) if isinstance(response.data, str): return response.status, response.data |