Created
December 17, 2010 14:54
-
-
Save sourcerebels/745057 to your computer and use it in GitHub Desktop.
Check if Google's URL is avaliable
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
''' | |
Created on 17/12/2010 | |
@author: Edu Rodriguez Castillo <http://www.sourcerebels.com> | |
''' | |
import urllib2 | |
def isAlive(url): | |
try: | |
urllib2.urlopen(url) | |
return True | |
except urllib2.URLError: | |
return False | |
if __name__ == '__main__': | |
if isAlive('http://www.google.com'): | |
print 'Google still alive' | |
else: | |
print 'Google is not alive' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment