rishbot is the libray for slackbot.
Now, the repository is not registered to PyPI. So, you can install it by the following command.
pip install git+https://github.com/rishiyama/rishbot
Please set the following environment variables to your ~/.bashrc. SLACK_URL is the url of incoming webhook of slack. So, You need to set it to your slack channel.
export SLACK_URL=https://hooks.slack.com/services/x/y/z
Then, please reload your ~/.bashrc.
source ~/.bashrc
Default message is "All finished !!!".
>>> import rishbot as rs
>>> rs.notify_slack()
Custom message is also available.
>>> import rishbot as rs
>>> rs.notify_slack("End of the process")
https://github.com/rishiyama/rishbot/blob/main/rishbot/notify.py
import requests
import os
import json
# send slack message
def notify_slack(text=f'FIX HERE'):
requests.post(os.getenv('SLACK_URL'), data=json.dumps({'text': text}))
you can change the message by changing the text variable, FIX HERE.