add timeout to Ping

This commit is contained in:
geoffrey45
2022-06-21 08:46:43 +03:00
parent 61f9af86aa
commit 2b5e9c02bb
+2 -2
View File
@@ -183,7 +183,7 @@ class Ping:
@staticmethod
def __call__() -> bool:
try:
requests.get("https://google.com")
requests.get("https://google.com", timeout=10)
return True
except requests.exceptions.ConnectionError:
except (requests.exceptions.ConnectionError, requests.Timeout):
return False