Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion edubotics_core/dataloader/webpage_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def url_exists(self, url: str) -> bool:
return response.status_code == 200
except requests.ConnectionError:
return False
except requests.exceptions.Timeout:
return False

async def get_links(self, session: ClientSession, website_link: str, base_url: str):
if not website_link.startswith(base_url):
Expand Down Expand Up @@ -104,7 +106,7 @@ def is_webpage(self, url: str) -> bool:
response = requests.head(url, allow_redirects=True, timeout=TIMEOUT)
content_type = response.headers.get("Content-Type", "").lower()
return "text/html" in content_type
except requests.RequestException:
except (requests.RequestException, ValueError, requests.exceptions.Timeout):
return False

def clean_url_list(self, urls):
Expand Down