From 6eca5f6c6fede66936a558ddc219d4279cd7c4b0 Mon Sep 17 00:00:00 2001 From: Judah Paul Date: Sun, 9 Jun 2024 22:20:19 -0400 Subject: [PATCH] Use HTTP instead of ICMP for network connectivity check - Fixes #53 --- src/common.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common.py b/src/common.py index ea174c7..92fabf9 100644 --- a/src/common.py +++ b/src/common.py @@ -75,7 +75,11 @@ def success(self, message, *args, **kws): display_lock = asyncio.Lock() def network_connected(): - return os.system("ping -c 1 google.com") == 0 + try: + response = requests.get("http://www.google.com", timeout=5) + return response.status_code == 200 + except requests.RequestException: + return False # Manually draw a degree symbol ° def degree_symbol(display, x, y, radius, color):