Merge pull request #118 from tomxtobin/fix-internet-util
Fix internet() test function
This commit is contained in:
commit
025d74555d
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user