From 712adb5e095a5385b51116c2d8b2ae48a536127d Mon Sep 17 00:00:00 2001 From: Crinibus <57172157+Crinibus@users.noreply.github.com> Date: Fri, 27 Nov 2020 16:10:42 +0100 Subject: [PATCH] Update scraper.py **Tech scraper:** scraper.py - Add try except when calling method get_part_num in class Scraper --- tech_scraper/scraper.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tech_scraper/scraper.py b/tech_scraper/scraper.py index 5039e30d..db048237 100644 --- a/tech_scraper/scraper.py +++ b/tech_scraper/scraper.py @@ -65,7 +65,15 @@ def __init__(self, category: str, URL: str): self.name = Format.change_æøå(Format.change_name(self.name)) self.date = str(datetime.today().strftime('%Y-%m-%d')) - self.get_part_num() + + try: + self.get_part_num() + except Exception as err: + self.logger.error( + f'Failed in method "{self.__class__.__name__}.get_part_num()": {err}', + exc_info=True + ) + self.shorten_url() self.check_part_num()