From f7f3737242bc3434e4056cac63688b12b8ba0f70 Mon Sep 17 00:00:00 2001 From: matthias Date: Fri, 17 Jan 2020 09:52:41 +0000 Subject: [PATCH] =?UTF-8?q?=E2=80=9Ebibcheck.py=E2=80=9C=20=C3=A4ndern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bibcheck.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bibcheck.py b/bibcheck.py index a343970..330f274 100644 --- a/bibcheck.py +++ b/bibcheck.py @@ -55,11 +55,16 @@ def check(username, password, notify_ids): date = datetime.datetime.strptime(info[1], '%d.%m.%Y') delta = date - datetime.datetime.now() allinfo.append(str(info)) - if delta.days <= 10 or delta.days == 20 or delta.days == 15: + if (delta.days > 7 and delta.days <= 10) or delta.days == 20 or delta.days == 15: for client in itertools.chain(notify_ids, os.environ.get('PUSHOVER_CLIENTS', '').split(',')): - print("CLIENT {client}") try: - pushover.Client(client).send_message(f'Bitte an {info[3]} denken, Abgabe {info[3]} - {username}', title="Erinnerung") + pushover.Client(client).send_message(f'Bitte an {info[3]} denken, Abgabe {info[3]} - {username}', title="Erinnerung") + except: + print("No client") + if delta.days <= 7: + for client in itertools.chain(notify_ids, os.environ.get('PUSHOVER_CLIENTS', '').split(',')): + try: + pushover.Client(client).send_message(f'Bitte an {info[3]} denken, Abgabe {info[3]} - {username}', title="Erinnerung") except: print("No client") except (StopIteration, mechanize._mechanize.LinkNotFoundError) as e: