From e6283cf4deb7437080cb4eb4e294a215f730d2fe Mon Sep 17 00:00:00 2001 From: salko-ua Date: Sun, 1 Dec 2024 23:52:21 +0200 Subject: [PATCH] debuger --- olxparser/parser.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/olxparser/parser.py b/olxparser/parser.py index 3ed4c54..dc120ec 100644 --- a/olxparser/parser.py +++ b/olxparser/parser.py @@ -10,10 +10,14 @@ def get_url(url): - response = requests.get(url) - soup = BeautifulSoup(response.content, "html.parser") - return soup - + try: + response = requests.get(url) + response.raise_for_status() + soup = BeautifulSoup(response.content, "html.parser") + return soup + except Exception as e: + response = requests.get(url) + raise (str(response) + "\n\n" + e) class Information: # Парсинг 10 перших фото