def _internet_on(address):
"""
Check to see if the internet is on by pinging a set address.
:param address: the IP or address to hit
:return: a boolean - true if can be reached, false if not.
"""
try:
urllib2.urlopen(address, timeout=1)
return True
except urllib2.URLError as err:
return False
评论列表
文章目录