diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-05-21 18:56:05 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-05-21 18:56:05 +0000 |
commit | 54deae27eed83a162ee438ef6bad4a23767757dd (patch) | |
tree | da5333377dfacf22177375aef822a8e696f007eb /collectors/python.d.plugin/python_modules/bases/FrameworkServices/UrlService.py | |
parent | Releasing debian version 1.14.0-1. (diff) | |
download | netdata-54deae27eed83a162ee438ef6bad4a23767757dd.tar.xz netdata-54deae27eed83a162ee438ef6bad4a23767757dd.zip |
Merging upstream version 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 |