From 221bf94786188918efa89b0358ff5d1b06969e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Tue, 15 Nov 2022 18:46:16 +0100 Subject: compare only tz naive utc --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index 198eff9..4fb9add 100755 --- a/app.py +++ b/app.py @@ -80,7 +80,7 @@ def update(engine, hmfan2iarts=100): if (r.status_code == 200): failed_acsms_not200_in_a_row = 0 if r.status_code != 200: - if borrow.purchase_utc > datetime.now(timezone.utc) - timedelta(hours=1): + if borrow.purchase_utc != None and borrow.purchase_utc > datetime.now(timezone.utc).replace(tzinfo=None) - timedelta(hours=1): logger.info(f"we are done for now, as server responded with {r.status_code} for queried acsm id {acsm_id} and the last requested acsm was created less than an hour ago") break logger.warning(f"received http response with error code not 200 (it is {r.status_code}). if this continues for {hmfan2iarts-failed_acsms_not200_in_a_row} more requests, I'll assume there are no more borrows on the server.") -- cgit v1.2.3