Failing on missing path, i.e. no 'www.'

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Glenn Jocher authored and GitHub committed 2022-09-27 00:29:23 +02:00
1 parent 6b2c9d1d0f
commit 1460e57157
1 file changed
+1 -1
+1 -1
View File
@@ -21,7 +21,7 @@ def is_url(url, check=True):
try:
url = str(url)
result = urllib.parse.urlparse(url)
assert all([result.scheme, result.netloc, result.path]) # check if is url
assert all([result.scheme, result.netloc]) # check if is url
return (urllib.request.urlopen(url).getcode() == 200) if check else True # check if exists online
except (AssertionError, urllib.request.HTTPError):
return False