Created
March 16, 2016 17:21
-
-
Save 0xv/5fc1538438f6007c8d8d to your computer and use it in GitHub Desktop.
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 characters
import urllib | |
def isup(domain): | |
httpcode = { | |
200 : 'site is up', | |
301 : "Moved Permanently", | |
400 : "Bad Request", | |
403 : "Forbidden", | |
403 : "404 Not Found", | |
408 : "Request Timeout", | |
410 : "resource requested is no longer available", | |
444 : "No Response (Nginx)", | |
500 : "Internal Server Error", | |
502 : "Bad Gateway", | |
503 : "Service Unavailable", | |
504 : "Gateway Timeout", | |
509 : "Bandwidth Limit Exceeded" | |
} | |
if not domain.startswith("http://"): | |
domain = "http://"+ domain | |
try: | |
req = urllib.urlopen(domain).getcode() | |
print httpcode[req] | |
except IOError, ex: | |
asu = str(ex) | |
print asu | |
isup('gamesjar.com') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment