get lunch menus sent to your e-mail/groupchat
Clone the repo:
$ git clone https://github.com/helb/jidlobot.git
$ cd jidlobot
Create a virtual environment:
$ virtualenv -p `which python3` .venv
$ source .venv/bin/activate
Install dependencies:
$ pip install -r requirements.txt
Copy jidlobot.yml.example
to jidlobot.yml
and set:
HTTP_TIMEOUT
to the number of seconds you would want to wait for each URLURLS
– list of urls, supported sites are:menicka.cz
zomato.com
(they have some scraping protection in place, make sure to haveZOMATO_UA
set in your config)
BACKENDS
– where to send the message:mail
mattermost
hipchat
rocketchat
console
(just prints the output).
If using mail
backend:
MAIL_FROM
– Sender e-mail addressMAIL_TO
– List of recipientsMAIL_SERVER
(defaultlocalhost
) andMAIL_PORT
(default25
) – MTA (SMTP server) addressMAIL_USER
(default same asMAIL_FROM
) andMAIL_PW
– SMTP server credentials (not used ifMAIL_PW
is not set)MAIL_STARTTLS
(defaultTrue
) – Use STARTTLS connection method- If your local MTA works well, set
MAIL_FROM
andMAIL_TO
only
If using mattermost
backend:
MATTERMOST_WEBHOOK
– URL for webhook,https://mattermost.…/hooks/…
MATTERMOST_CHANNEL
– channel nameMATTERMOST_USERNAME
– bot's username
If using hipchat
backend:
HIPCHAT_URL
– URL of your HipChat server, with trailing slashHIPCHAT_ROOM
– room IDHIPCHAT_TOKEN
– room notification tokenHIPCHAT_COLOR
– message background, valid values areyellow
,green
,red
,purple
,gray
, andrandom
.
If using rocketchat
backend:
ROCKETCHAT_WEBHOOK
– URL for webhook,https://rocketchat.…/hooks/…
ROCKETCHAT_CHANNEL
– channel name
More than one backend can be used at the same time, eg.:
BACKENDS:
- mattermost
- mail
- console
$ ./jidlobot.py
Create a cron job if everything works.
Example script for running from cron:
#!/bin/bash
set -e
cd /path/to/jidlobot
source .venv/bin/activate
python jidlobot.py
Example crontab entry (runs Monday to Friday at 10:58):
58 10 * * 1-5 /path/to/jidlobot.sh