22 lines
628 B
Python
Executable File
22 lines
628 B
Python
Executable File
#!/usr/bin/env python
|
|
import urllib2, sys
|
|
|
|
pages=["https://csclub.uwaterloo.ca", "http://mirror.csclub.uwaterloo.ca"]
|
|
|
|
for page in pages:
|
|
try:
|
|
r = urllib2.urlopen(page, timeout=3)
|
|
page = r.read()
|
|
if not len(page) > 1000:
|
|
print "FAIL, didn't have enough data"
|
|
sys.exit(2)
|
|
if not"Computer Science Club" in page:
|
|
print "FAIL, homepage doesn't mention Computer Science Club"
|
|
sys.exit(3)
|
|
# So read() didn't throw an exception, nor did opening,
|
|
# and we have enough data, so likely good.
|
|
sys.exit(0)
|
|
except urllib2.URLError as e:
|
|
print "FAIL, exception ", e
|
|
sys.exit(1)
|