Use urllib2 to check internet connection in main