This python script scrapes current traffic reports from the Karlsruhe Transport Association and sends them by email.
- Create virtual environment project folder:
python3 -m venv venv
- Activate virtual environment:
source venv/bin/activate
- Install requirements:
pip install -r requirements.txt
- Quit virtual environment:
deactivate
- Fill
mail_config.json
:
{
"MAIL_USER": string,
"MAIL_PW": string,
"SMTP_SERVER": string,
"SMTP_PORT": number
}
- Run shell script with email addresses to notify:
source run.sh "email1@domain.com{string1|string2}" "email2@domain.com{string1&string2|string3}" ...
. Optionally, AND-filters (&) and OR-filters (|) can be used. The following filter captures most of the lines running through the city center:{IRE| 1 | 1,| 2 | 2,| 3 | 3,| 4 | 4,| 5 | 5,|S1|S2|S3|S4|S5|S6|S7|S8|S9|allen Linie|alle Linie|Alle Linie|Allen Linie}
- Set up cron job to poll for reports (only new reports are sent).