+-+-+-+-+-+-+-+ |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.
Metadata
Release files for sandesh 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sandesh-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for sandesh-0.3.2-py3-none-any.whl |
Release files / sandesh-0.3.2-py3-none-any.whl
| Download URL | sandesh-0.3.2-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33e5c35e40ca7c879c88180b5bd222d0a31a557e193cfbae012be95b2a7e13e0
|
|
BLAKE2b-256 checksum How to use checksums |
0b3ecdacda5a2fcf690860edb37c15603d82431bdedeb11d9ee36dd171473898
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.0
|
Security for sandesh 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.