Created
March 9, 2019 10:23
-
-
Save sandgate-dev/4d67662ae933e3539322e06b40903c1c to your computer and use it in GitHub Desktop.
Revisions
-
sandgate-dev created this gist
Mar 9, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ # How can I determine if anything at the given url exists # https://stackoverflow.com/a/1966141/5983691 # # 4xx status codes describe client errors (like "404 Not found") # 5xx status codes describe server errors (like "500 Internal server error") from urllib2 import urlopen code = urlopen("http://example.com/").code if (code / 100 >= 4): print "Nothing there."