Skip to content

Instantly share code, notes, and snippets.

@0xv
Created March 16, 2016 17:21
Show Gist options
  • Save 0xv/5fc1538438f6007c8d8d to your computer and use it in GitHub Desktop.
Save 0xv/5fc1538438f6007c8d8d to your computer and use it in GitHub Desktop.
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