From b9ed7e2d202893bccb7f32e2ed1f58a433d979ba Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Thu, 12 Aug 2021 12:56:26 +0200 Subject: [PATCH] Let the fetcher throw an exception which will be caught and handed to the operator anyway --- backend/content_fetcher.py | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/backend/content_fetcher.py b/backend/content_fetcher.py index 073ee360..50d649ec 100644 --- a/backend/content_fetcher.py +++ b/backend/content_fetcher.py @@ -109,24 +109,14 @@ class html_requests(Fetcher): def run(self, url, timeout, request_headers): import requests - try: - r = requests.get(url, - headers=request_headers, - timeout=timeout, - verify=False) - - html = r.text - - # Usually from networkIO/requests level - except ( - requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout, - requests.exceptions.MissingSchema) as e: - self.error = str(e) - return None - - except Exception as e: - self.error = "Other exception" + str(e) - return None + + r = requests.get(url, + headers=request_headers, + timeout=timeout, + verify=False) + + html = r.text + # @todo test this if not r or not html or not len(html):