From c5462fd1810969012164e26192758606fd462b5d Mon Sep 17 00:00:00 2001 From: midnight Date: Tue, 3 Oct 2023 05:35:07 +0300 Subject: [PATCH] updated error handling --- page_analyzer/app.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/page_analyzer/app.py b/page_analyzer/app.py index 909d0a3..bd4bc75 100644 --- a/page_analyzer/app.py +++ b/page_analyzer/app.py @@ -112,6 +112,9 @@ def check_url(id): ): 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'})