Python package to notify you when your function is done through Telegram and/or Slack!
Project description
WhenDone
Python package to notify you when your function is done through Telegram and/or Slack!
Installation
$ pip install whendone
Usage
Telegram Example
First create a bot through @BotFather
Start a conversation with the bot, only once required, /start.
Obtain the token and add it, see code below.
# Import library
from whendone import WhenDone
# Initialize
notifier = WhenDone(telegram_token='XXXXXXXXXXX')
# Add decorator to function
@notifier.whendone
def Test():
print('Hello World')
# Function call
Test()
Slack Example
Browse to https://api.slack.com/apps create a new app from scratch, give it a name and assign it to a group or person. On the app page, browse to OAuth & Permissions, go to Scope and the following scope, chat:write, reinstall the app and obtain the token. From slack open the chatbot, and obtain the id
The code is almost the same to the Telegram example, but with the addition of 1 line.
# Import library
from whendone import WhenDone
# Initialize
notifier = WhenDone(slack_token='XXXXXXXXXXX')
notifier.addSlackChatID('XXXXX')
# Add decorator to function
@notifier.whendone
def Test():
print('Hello World')
# Function call
Test()
Contributing
Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms. If you like it, don't forget to give it a ⭐!
License
WhenDone was created by Sabri Barac. It is licensed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file whendone-1.2.0.tar.gz.
File metadata
- Download URL: whendone-1.2.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.0 Darwin/22.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95fc5cc42090570dacff6175e748e6b85f04b563c7d883430ad2df119ed71aa8
|
|
| MD5 |
d5e70a98a543f5075f9b343cd1fbc823
|
|
| BLAKE2b-256 |
a63d02cba67329989e04e497467a1dd9168f9fed3e29d00545e6bba923aaaa75
|
File details
Details for the file whendone-1.2.0-py3-none-any.whl.
File metadata
- Download URL: whendone-1.2.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.0 Darwin/22.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5e232e0d41368340c517e557297e0f4e0c8bac11a34e540b520b3b07dfc2f03
|
|
| MD5 |
8aab5bb2a134df33f574c8a1bae5e141
|
|
| BLAKE2b-256 |
1174445f0eb322d2c543b521e02d6a1abc6ce139353b08161f9cb110feaa185e
|