From 9bc74afb68a2716262cda74a741b761a2a1090d1 Mon Sep 17 00:00:00 2001 From: midnight Date: Tue, 3 Oct 2023 05:47:01 +0300 Subject: [PATCH] corrected mistakes --- page_analyzer/app.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/page_analyzer/app.py b/page_analyzer/app.py index bd4bc75..105f4ac 100644 --- a/page_analyzer/app.py +++ b/page_analyzer/app.py @@ -104,17 +104,10 @@ def check_url(id): render_url(id=id, table='urls', col='id')[0]['name'], timeout=5 ) - except ( - requests.Timeout, - requests.ConnectionError, - requests.HTTPError, - requests.RequestException - ): + page.raise_for_status() + except requests.RequestException: flash('Произошла ошибка при проверке', 'error') return redirect(url_for('url_info', id=id)) - else: - if page.status_code != 200: - flash('Произошла ошибка при проверке', 'danger') soup = BeautifulSoup(page.text, 'html.parser') crutch = soup.find('meta', attrs={'name': 'description'})