Skip to content

Instantly share code, notes, and snippets.

@fedir
fedir / checkUrlExists.m1.py
Last active May 25, 2022 14:56
Check if URL exists via Python
from urllib2 import urlopen
code = urlopen("http://example.com/").code
if (code / 100 >= 4):
print "Nothing there."
# via http://stackoverflow.com/questions/1966086/how-can-i-determine-if-anything-at-the-given-url-does-exist