summaryrefslogtreecommitdiff
path: root/src/backend/checkenv.py
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-04-15 10:34:53 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-04-15 10:34:53 +0100
commitece66a4e9e5d46baa0376bd972f2d4e718b91062 (patch)
tree1c9e73f1e5cc4a78c36dcfe414cbceb63a4e2187 /src/backend/checkenv.py
parent44f62d1aba2751d2d2909cc6eec5cb659a8ecde4 (diff)
check for internet connectivity, and stop execution if there is none
Diffstat (limited to 'src/backend/checkenv.py')
-rw-r--r--src/backend/checkenv.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/backend/checkenv.py b/src/backend/checkenv.py
index c8152bf..124ba76 100644
--- a/src/backend/checkenv.py
+++ b/src/backend/checkenv.py
@@ -3,6 +3,19 @@
import os
import subprocess
import sisyphus.getenv
+import urllib.request
+
+
+def connectivity():
+ is_online = int()
+
+ try:
+ urllib.request.urlopen("http://www.google.com", timeout=5)
+ is_online = int(1)
+ except urllib.error.URLError:
+ is_online = int(0)
+
+ return is_online
def root():