Added Readme, small fixes

This commit is contained in:
2019-05-01 22:17:07 +02:00
parent ec6dc78f04
commit b85794af20
5 changed files with 65 additions and 2 deletions

52
README.md Normal file
View File

@@ -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 <username>
```
### Step 2 add notification mechanism
```
source venv/bin/activate
python -m infomentor --addmail <username>
```
or
```
source venv/bin/activate
python -m infomentor --addpushover <username>
```
### 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 <username>
```
## 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.

View File

@@ -174,6 +174,8 @@ def main():
add_user(args.adduser) add_user(args.adduser)
elif args.addpushover: elif args.addpushover:
add_pushover(args.addpushover) add_pushover(args.addpushover)
elif args.addmail:
add_mail(args.addmail)
elif args.addcalendar: elif args.addcalendar:
add_calendar(args.addcalendar) add_calendar(args.addcalendar)
else: else:

View File

@@ -10,8 +10,12 @@ def load():
if not os.path.isfile('infomentor.ini'): if not os.path.isfile('infomentor.ini'):
_config.add_section('pushover') _config.add_section('pushover')
_config.add_section('general') _config.add_section('general')
_config.add_section('smtp')
_config['pushover']['apikey'] = '' _config['pushover']['apikey'] = ''
_config['general']['secretkey'] = '' _config['general']['secretkey'] = ''
_config['smtp']['server'] = ''
_config['smtp']['username'] = ''
_config['smtp']['password'] = ''
with open('infomentor.ini', 'w+') as f: with open('infomentor.ini', 'w+') as f:
_config.write(f) _config.write(f)
_config.read('infomentor.ini') _config.read('infomentor.ini')

View File

@@ -214,8 +214,8 @@ class Informer(object):
self._send_mail(outer) self._send_mail(outer)
def _send_mail(self, mail): def _send_mail(self, mail):
s = smtplib.SMTP_SSL('09a.de') s = smtplib.SMTP_SSL(cfg['smtp']['server'])
s.login('infomentor@09a.de', '***REMOVED***') s.login(cfg['smtp']['username'], cfg['smtp']['password'])
s.send_message(mail) s.send_message(mail)
s.quit() s.quit()

View File

@@ -3,3 +3,8 @@ sqlalchemy
dateparser dateparser
python-pushover python-pushover
pycrypto pycrypto
bs4
flask
flask-bootstrap
caldav
icalendar