Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions doc/changelog.d/4396.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Raise the underlying urlerror while downloading example file
13 changes: 11 additions & 2 deletions src/ansys/fluent/core/utils/networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from concurrent import futures
import logging
import socket
import ssl
from typing import Any
import urllib.request

Expand Down Expand Up @@ -130,12 +131,20 @@ def check_url_exists(url: str) -> bool:
-------
bool
True if the URL exists, False otherwise

Raises
------
ssl.SSLError
If there is an SSL error while checking the URL
"""
try:
with urllib.request.urlopen(url) as response:
return response.status == 200
except Exception:
return False
except urllib.error.URLError as ex:
if ex.__context__ and isinstance(ex.__context__, ssl.SSLError):
raise ex.__context__
else:
return False


def get_url_content(url: str) -> str:
Expand Down