mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-10-29 09:24:42 +00:00
add timeout to Ping
This commit is contained in:
1 parent
61f9af86aa
commit
2b5e9c02bb
1 file changed
+2
-2
@@ -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