I wanted to check if a certain website exists, this is what I\'m doing:
user_agent = \'Mozilla/20.0.1 (compatible; MSIE 5.5; Windows NT)\'
headers = { \'User
You can simply use stream method to not download the full file. As in latest Python3 you won't get urllib2. It's best to use proven request method. This simple function will solve your problem.
def uri_exists(uri):
r = requests.get(url, stream=True)
if r.status_code == 200:
return True
else:
return False