From 6ea9844d0072d27d2aedfd0bbf4326d73fc2fcb9 Mon Sep 17 00:00:00 2001 From: Jason Schwarzenberger Date: Wed, 4 Nov 2020 15:37:19 +1300 Subject: [PATCH] remove useless try blocks. --- apiserver/scrapers/declutter.py | 13 +++++-------- apiserver/scrapers/local.py | 13 +++++-------- apiserver/scrapers/outline.py | 11 ++++------- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/apiserver/scrapers/declutter.py b/apiserver/scrapers/declutter.py index d516423..4fdaed1 100644 --- a/apiserver/scrapers/declutter.py +++ b/apiserver/scrapers/declutter.py @@ -9,14 +9,11 @@ TIMEOUT = 30 def get_html(url): - try: - logging.info(f"Declutter Scraper: {url}") - details = get_details(url) - if not details: - return '' - return details['content'] - except: - raise + logging.info(f"Declutter Scraper: {url}") + details = get_details(url) + if not details: + return '' + return details['content'] def get_details(url): try: diff --git a/apiserver/scrapers/local.py b/apiserver/scrapers/local.py index 489eae8..dd81f93 100644 --- a/apiserver/scrapers/local.py +++ b/apiserver/scrapers/local.py @@ -8,14 +8,11 @@ READ_API = 'http://127.0.0.1:33843/details' TIMEOUT = 20 def get_html(url): - try: - logging.info(f"Local Scraper: {url}") - details = get_details(url) - if not details: - return '' - return details['content'] - except: - raise + logging.info(f"Local Scraper: {url}") + details = get_details(url) + if not details: + return '' + return details['content'] def get_details(url): try: diff --git a/apiserver/scrapers/outline.py b/apiserver/scrapers/outline.py index b3c0574..f96cd2a 100644 --- a/apiserver/scrapers/outline.py +++ b/apiserver/scrapers/outline.py @@ -9,13 +9,10 @@ OUTLINE_API = 'https://api.outline.com/v3/parse_article' TIMEOUT = 20 def get_html(url): - try: - details = get_details(url) - if not details: - return '' - return details['html'] - except: - raise + details = get_details(url) + if not details: + return '' + return details['html'] def get_details(url): try: