added notification

This commit is contained in:
2019-09-24 17:48:02 +02:00
parent afc6e42570
commit 5a467dee04

View File

@@ -1,8 +1,11 @@
import requests
import bs4
import configparser
import urllib.parse
import mechanize
import pushover
import datetime
pushover.init('a5uja274ec5h46paanzjqy5zo1ym6y')
def main():
br = mechanize.Browser()
@@ -19,8 +22,11 @@ def main():
table = lentlist.select('table[class="rTable_table"]')[0]
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()
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")
if __name__ == "__main__":
main()