summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2016-06-24 10:42:39 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2016-06-24 10:42:39 +0200
commit7daa3fc85a892adb016b35d517025d1e064943f4 (patch)
treeac348b1c2b5a292c3e454221b2792a1e39b00200
downloadupytime-7daa3fc85a892adb016b35d517025d1e064943f4.tar.gz
upytime-7daa3fc85a892adb016b35d517025d1e064943f4.zip
first commit
-rw-r--r--.gitignore1
-rwxr-xr-xupytime.py26
2 files changed, 27 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..338bb66
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+log.csv
diff --git a/upytime.py b/upytime.py
new file mode 100755
index 0000000..8410ef7
--- /dev/null
+++ b/upytime.py
@@ -0,0 +1,26 @@
+#!/usr/bin/python3
+
+import requests
+import schedule
+import csv
+import datetime
+import time
+
+URL = "https://schneefux.xyz/"
+LOG = "log.csv"
+
+def ping():
+ f = open(LOG, "w+")
+ log = csv.writer(f)
+
+ elapsed = requests.get(URL, timeout=10).elapsed.total_seconds()
+ log.writerow([datetime.datetime.now(), elapsed])
+
+ f.close()
+
+schedule.every().minute.do(ping)
+if __name__ == "__main__":
+ ping()
+ while True:
+ schedule.run_pending()
+ time.sleep(1)