Apr 12, 2018 10:33 AM
(This post was last modified: Apr 12, 2018 10:47 AM by Skidy.)
Checking if a website exists it easy, but if it doesn't exist it takes ages to verify.
E.g
If the site doesn't exist, it takes ages to verify it. I need to it check within 2 seconds. Any ideas?
E.g
Code
from urllib.request import Request, urlopen
from urllib.error import URLError, HTTPError
req = Request("http://stackoverflow.com")
try:
response = urlopen(req)
except HTTPError as e:
print('The server couldn\'t fulfill the request.')
print('Error code: ', e.code)
except URLError as e:
print('We failed to reach a server.')
print('Reason: ', e.reason)
else:
print ('Website is working fine')If the site doesn't exist, it takes ages to verify it. I need to it check within 2 seconds. Any ideas?



