Skip to main content

sandesh - a simple app to send messages on slack

Project description

+-+-+-+-+-+-+-+ |s|a|n|d|e|s|h| +-+-+-+-+-+-+-+

sandesh (संदेश) in Hindi means message. This is a simple python library to send messages to Slack using webhook urls.

Installing

You can install the bleeding edge version of this library by doing:

git clone git@github.com:abhishekkrthakur/sandesh.git
cd sandesh
python setup.py install

Or from pip:

pip install sandesh

Usage

Using sandesh is very easy.

First of all you need a webhook. You can either keep this webhook as environment variable: SANDESH_WEBHOOK Or you can send it in the send function: sandesh.send(msg, webhook="XXXXX").

I like to keep it as environment variable so that I dont accidently push it to GitHub ;)

You can send a message to the provided webhook by doing:

import sandesh

loss = 0.15
msg = f"Training loss was {loss}"
sandesh.send(msg)

sandesh also supports dictionaries, OrderedDict and defaultdict. An example for OrderedDict is provided below:

import collections
import sandesh

log = collections.OrderedDict([
        ('training_epoch', 5),
        ('loss', 0.08)
    ])
sandesh.send(log)

If you want to go fancy, take a look at custom messages for slack. You can create your own custom message and send using:

import sandesh

# data = Fancy slack json
sandesh.send(data, use_raw=True)

This is a simple app that I use to send me notifications of my training processes from home workstation or AWS/GCP machines.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

sandesh-0.3.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file sandesh-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: sandesh-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.0

File hashes

Hashes for sandesh-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8ab6841a7eed811e62cf005b3bafc108f30e57c307d38cdfc5450653df249bf8
MD5 12ff6bdf8f592a90f2ec016541ebba5e
BLAKE2b-256 bef86e02987cf58a56d7fed21cec80d756c1dd9ae9b28ab205022bf34b55b60c

See more details on using hashes here.

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