Skip to content

Instantly share code, notes, and snippets.

@sourcerebels
Created December 17, 2010 14:54
Show Gist options
  • Save sourcerebels/745057 to your computer and use it in GitHub Desktop.
Save sourcerebels/745057 to your computer and use it in GitHub Desktop.
Check if Google's URL is avaliable
'''
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