mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
add timeout to Ping
This commit is contained in:
@@ -183,7 +183,7 @@ class Ping:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def __call__() -> bool:
|
def __call__() -> bool:
|
||||||
try:
|
try:
|
||||||
requests.get("https://google.com")
|
requests.get("https://google.com", timeout=10)
|
||||||
return True
|
return True
|
||||||
except requests.exceptions.ConnectionError:
|
except (requests.exceptions.ConnectionError, requests.Timeout):
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user