Metadata-Version: 2.1
Name: deco-slack
Version: 0.0.1
Summary: deco_slack notifies you if a method has completed successfully or not.
Home-page: https://github.com/taross-f/deco-slack
Author: taross-f
Author-email: taro.furuya@gmail.com
Requires-Python: >=3.6,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Dist: slack-sdk (>=3.3.1,<4.0.0)
Project-URL: Repository, https://github.com/taross-f/deco-slack
Description-Content-Type: text/markdown

# decoslack

decoslack notifies you via Slack if a method has completed successfully or not.

## Description

- Notify Slack when a process starts, ends normally, or ends abnormally.
- Each notification can be set on or off.

## Configurations
Environment variables to set
- SLACK_TOKEN
  - Slack bot token that can be used with chat:write.public scope.
- SLACK_CHANNEL
  - Channel name to be notified without # (like notify_xxx not #notify_xxx)

## Example

```py
from deco_slack import deco_slack


@deco_slack(
    # These parameters are all optional
    start={
        "text": "start text",
        "title": 'start',
        "color": "good"
    },
    success={
        "text": "success text",
        "title": 'success',
        "color": "good"
    },
    error={
        "title": 'error',
        "color": "danger",
        "stacktrace": True # Set True if you need stacktrace in a notification
    },
)
def test1():
  print('test1')


@deco_slack(
    success={
        "text": "success text",
        "title": 'success',
        "color": "good"
    },
    error={
        "title": 'error',
        "color": "danger",
        "stacktrace": True
    },
)
def error1():
  raise ValueError('error occured.')

```

