Files
bearhub/bauh/commons/internet.py
2020-04-20 10:29:23 -03:00

13 lines
269 B
Python

import http.client as http_client
def is_available() -> bool:
conn = http_client.HTTPConnection("www.google.com", timeout=5)
try:
conn.request("HEAD", "/")
conn.close()
return True
except:
conn.close()
return False