Skip to content

Instantly share code, notes, and snippets.

@ekohl
Created February 25, 2010 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ekohl/314584 to your computer and use it in GitHub Desktop.
Save ekohl/314584 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import urllib2
import sys
for site in sys.argv[1:]:
try:
s = urllib2.urlopen(site)
print s.url, s.code, s.msg, s.headers.get('X-Server', None)
except urllib2.HTTPError, e:
print >> sys.stderr, e.url
print >> sys.stderr, e
print >> sys.stderr, e.headers
except urllib2.URLError, e:
print >> sys.stderr, site
print >> sys.stderr, e.reason
print >> sys.stderr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment