Skip to main content

deco_slack notifies you if a method has completed successfully or not.

Project description

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

  • {DECO_SLACK_PREFIX}SLACK_TOKEN
    • Slack bot token that can be used with chat:write.public scope.
  • {DECO_SLACK_PREFIX}SLACK_CHANNEL
    • Channel name to be notified without # (like notify_xxx not #notify_xxx)
  • DECO_SLACK_PREFIX (optional)
    • Prefix for environment variables.
      • If not set, defaults to "".

Example

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.')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deco_slack-0.0.2.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

deco_slack-0.0.2-py3-none-any.whl (2.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page