diff --git a/README.md b/README.md new file mode 100644 index 0000000..01396e4 --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +# Infomentor Tool + +This tool is designed to check the infomentor portal and send notifications using mail or pushover api. + +## Usage + +``` +python3 -m venv venv +source venv/bin/activate +python setup.py install +python -m infomentor +``` + +After the first run a `infomentor.ini` file is available which has a few values to be entered. + +## Manage Users + + +### Step 1 create a user + +Provide the username and password for infomentor. +``` +source venv/bin/activate +python -m infomentor --adduser +``` +### Step 2 add notification mechanism +``` +source venv/bin/activate +python -m infomentor --addmail +``` + +or + +``` +source venv/bin/activate +python -m infomentor --addpushover +``` + +### Step 3 (optional) Add iCloud calendar + +It is capable of syncing all the infomentor calendar elements to icloud calendar + +``` +source venv/bin/activate +python -m infomentor --addcalendar +``` + +## NB + +The login process is a bit scary and mostly hacked. It happens often on the first run, that the login is not ready, the second run then should work without errors. + +The script shall be run every 10 minutes, that will keep the session alive and minimize errors. diff --git a/infomentor/__main__.py b/infomentor/__main__.py index 54e6e57..a65102d 100644 --- a/infomentor/__main__.py +++ b/infomentor/__main__.py @@ -174,6 +174,8 @@ def main(): add_user(args.adduser) elif args.addpushover: add_pushover(args.addpushover) + elif args.addmail: + add_mail(args.addmail) elif args.addcalendar: add_calendar(args.addcalendar) else: diff --git a/infomentor/config.py b/infomentor/config.py index 0ae0d7f..14db11c 100644 --- a/infomentor/config.py +++ b/infomentor/config.py @@ -10,8 +10,12 @@ def load(): if not os.path.isfile('infomentor.ini'): _config.add_section('pushover') _config.add_section('general') + _config.add_section('smtp') _config['pushover']['apikey'] = '' _config['general']['secretkey'] = '' + _config['smtp']['server'] = '' + _config['smtp']['username'] = '' + _config['smtp']['password'] = '' with open('infomentor.ini', 'w+') as f: _config.write(f) _config.read('infomentor.ini') diff --git a/infomentor/informer.py b/infomentor/informer.py index 6dbbe8d..1733f95 100755 --- a/infomentor/informer.py +++ b/infomentor/informer.py @@ -214,8 +214,8 @@ class Informer(object): self._send_mail(outer) def _send_mail(self, mail): - s = smtplib.SMTP_SSL('09a.de') - s.login('infomentor@09a.de', '***REMOVED***') + s = smtplib.SMTP_SSL(cfg['smtp']['server']) + s.login(cfg['smtp']['username'], cfg['smtp']['password']) s.send_message(mail) s.quit() diff --git a/requirements.txt b/requirements.txt index 96ea5f7..67ebd0d 100755 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,8 @@ sqlalchemy dateparser python-pushover pycrypto +bs4 +flask +flask-bootstrap +caldav +icalendar