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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file deco_slack-0.0.2.tar.gz.

File metadata

  • Download URL: deco_slack-0.0.2.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.15 CPython/3.10.0 Darwin/21.6.0

File hashes

Hashes for deco_slack-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ee7c47f676c7fffa7aa88702aa0590d9ba51eda7a9182f045bb3083ff9ba1239
MD5 831b7ed558fdce4dc3e3c047df8de19e
BLAKE2b-256 53a2358142b80efbcbef7c9f8e0526eda082c1c8ab34d5b8e373dcd4ccb0d229

See more details on using hashes here.

File details

Details for the file deco_slack-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: deco_slack-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.15 CPython/3.10.0 Darwin/21.6.0

File hashes

Hashes for deco_slack-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 38a7a3f5e0b3d18c3a3dc3a479dec15db1f875e2a4204b7e558bfe8341e9ca11
MD5 8a866e04fb3f7a37a03b70203bc88a48
BLAKE2b-256 45857caaea109ae1c71a7e57dbded3dfe935d1f275fe86094df0852b700f90f3

See more details on using hashes here.

Supported by

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