mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Update ohcapi.py
catch an exception when internet is not available Signed-off-by: Frédéric <fmatray@users.noreply.github.com>
This commit is contained in:
@ -70,7 +70,12 @@ class ohcapi(plugins.Plugin):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Check if the internet is still available by pinging Google
|
# Check if the internet is still available by pinging Google
|
||||||
|
try:
|
||||||
response = requests.get('https://www.google.com', timeout=5)
|
response = requests.get('https://www.google.com', timeout=5)
|
||||||
|
except requests.ConnectionError:
|
||||||
|
self.internet_active = False
|
||||||
|
return
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
self.internet_active = True
|
self.internet_active = True
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user