Check PIO download storage for "Internet ON"

This commit is contained in:
Ivan Kravets
2017-06-01 19:47:50 +03:00
parent a53a38b5dd
commit e2811a4a28
2 changed files with 10 additions and 9 deletions

2
docs

Submodule docs updated: 89630419d5...1666723f26

View File

@ -540,14 +540,15 @@ def get_api_result(url, params=None, data=None, auth=None, cache_valid=None):
def internet_on(timeout=3): def internet_on(timeout=3):
host = "dl.bintray.com" socket.setdefaulttimeout(timeout)
port = 443 for host in ("dl.bintray.com", "dl.platformio.org"):
try: try:
socket.setdefaulttimeout(timeout) socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect(
socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((host, port)) (host, 80))
return True return True
except: # pylint: disable=bare-except except: # pylint: disable=bare-except
return False pass
return False
def get_pythonexe_path(): def get_pythonexe_path():