From 8ef54a63062e48047a28c2b7f2b0d8b86091a228 Mon Sep 17 00:00:00 2001 From: Matthias Bilger Date: Sat, 28 Sep 2019 18:39:45 +0200 Subject: [PATCH] including post data in healthcheck --- bibcheck.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bibcheck.py b/bibcheck.py index a9e969c..2fa09da 100644 --- a/bibcheck.py +++ b/bibcheck.py @@ -21,15 +21,16 @@ def main(): response = br.follow_link(text_regex=r"Ausleihe zeigen") lentlist = bs4.BeautifulSoup(response.read(), 'html.parser') table = lentlist.select('table[class="rTable_table"]')[0] - import urllib.request - urllib.request.urlopen("https://health.d1v3.de/ping/5185e698-ea0b-44e0-857e-8f52487dca5d") + allinfo = [] for entry in table.tbody.select('tr'): info = list(map(lambda x: str(x.text).strip(), entry.select('td'))) 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: pushover.Client('u5w9h8gc7hpzvr5a2kh2xh4m9zpidq').send_message('Bitte an {} denken, Abgabe {}'.format(info[3], info[1]), title="Erinnerung") + requests.post("https://health.d1v3.de/ping/5185e698-ea0b-44e0-857e-8f52487dca5d", data='\n'.join(allinfo)) if __name__ == "__main__": main()