python - Check if the url link is correct -
I want to open several URLs (I open a URL, search for all the links on this webstream and open them Am or downloading images etc.) So first I wanted to know whether the URL is correct or not, so if I used the if
statement:
if urlparse.urlparse (link) .netloc: Return 'broken' Url '
But I noticed that some values do not pass this statement. When a link looks like this, I found a website: // b.thumbs.redditmedia.com/7pTYj4rOii6CkkEC.jpg
, but I had an error: ValueError: unknown url type: // b. Thumbs.redditmedia.com / 7pTYj4rOii6CkkEC.jpg
, but if my statement does not capture it, if a URL works well then how can I see more accurately?
If you are not specific about the library used, you can do the following :
Check your url:
& gt;
Check each one by opening the link:
# Your half It takes some time pure speed and not the link in the page >> gt; & gt; Is_fully_alive ("http://www.google.com", true) is true
< P> Check an invalid url: Error while trying to validate the link: >> & gt; & gt; Is_fully_alive ("// www.google.com"): //www.google.com unknown url type: //www.google.com incorrect
Comments
Post a Comment