I want to check if the URL is valid before opening it to read data.
I used the urlparse function from the urlparse package:
if not bool(urlparse.urlparse(url).netloc):
However, I noticed that some valid URLs are considered broken, for example:
url = upload.wikimedia.org/math/8/8/d/88d27d47cea8c88adf93b1881eda318d.png
This url is valid (I can open it using my browser).
Is there a better way to check if the URL is valid?
source share