Created
February 25, 2010 14:43
-
-
Save ekohl/314584 to your computer and use it in GitHub Desktop.
This file contains 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
#!/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