Skip to content

Commit

Permalink
fix: validation URL with requests
Browse files Browse the repository at this point in the history
  • Loading branch information
rememberYou committed Apr 13, 2021
1 parent f53b46c commit 6538faf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyrdf2vec/utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def is_valid_url(url: str) -> bool:
"""
try:
return requests.get(url).status_code == requests.codes.ok
return (
requests.head(url, headers={"Accept": "text/html"}).status_code
== requests.codes.ok
)
except Exception:
return False

0 comments on commit 6538faf

Please sign in to comment.