IPython magic for sending slack notifications
Project description
Installation
$ pip install ipyslack
Usage
Load the extension:
%load_ext ipyslack
Configure Slack API:
%slack_setup -t <api_token> -c <target_channel>
To obtain the API token visit this page. The <target_channel> parameter may either denote a channel (e.g. #general) or a user (e.g. @me).
Adding the option -u to %slack_setup will make yourself the sender of all messages. Otherwise (default) the messages originate from slackbot.
Now adding:
%%slack_notify <message>
at the top of any cell will send <message> to <target_channel> whenever cell execution is completed.
The patterns {out} and {err} within <message> will be substituted with stdout or stderr from the cell’s execution. The pattern {exc} denotes the exception (if any was thrown). The string \n denotes a new line.
Example:
%%slack_notify *Completed!* :heavy_plus_sign:\nStdout: {out}\nStderr: {err}\nException: {exc}
In addition, the line-magic %slack_send <message> lets you send notifications about partial results. E.g.:
%%slack_notify All done. {exc} ... computation ... %slack_send Half-way! ... computation ...
See also
IPyTelegram: https://github.com/kalaidin/ipytelegram/
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.