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

  • 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

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.1.tar.gz (2.5 kB view hashes)

Uploaded source

Built Distribution

deco_slack-0.0.1-py3-none-any.whl (2.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page