Fix internet() test function

The change in commit 6989713 broke the internet() test function by
trying to access the DNS port of "www.google.de", causing it to always
return False, which in turn broke all modules calling it. We instead use
the actual domain name of Google's DNS server at IP "8.8.8.8".
This commit is contained in:
Tom X. Tobin 2014-09-14 17:15:50 -04:00
parent fc015e8908
commit c8b4dc0466

View File

@ -353,12 +353,13 @@ def require(predicate):
def internet(): def internet():
""" """
Checks for a internet connection by connecting to 8.8.8.8 (Google DNS) Checks for a internet connection by connecting to a Google DNS
server.
:returns: True if internet connection is available :returns: True if internet connection is available
""" """
try: try:
socket.create_connection(("www.google.de", 53), 1).close() socket.create_connection(("google-public-dns-a.google.com", 53), 1).close()
return True return True
except OSError: except OSError:
return False return False