summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xupytime.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/upytime.py b/upytime.py
index 8410ef7..65621c5 100755
--- a/upytime.py
+++ b/upytime.py
@@ -10,10 +10,13 @@ URL = "https://schneefux.xyz/"
LOG = "log.csv"
def ping():
- f = open(LOG, "w+")
+ f = open(LOG, "a")
log = csv.writer(f)
- elapsed = requests.get(URL, timeout=10).elapsed.total_seconds()
+ try:
+ elapsed = requests.get(URL, timeout=10).elapsed.total_seconds()
+ except:
+ elapsed = 10
log.writerow([datetime.datetime.now(), elapsed])
f.close()