diff options
| -rwxr-xr-x | upytime.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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() |
