Notify you when a function finished with option to send a email or message to discord channel
Project description
Notifier Function Status
This library uses a decorator to show a toast in your screen or send you a email, message to discord channel or use a Telegram bot to send you a message when your function has finished.
Requeriments
Please install this packages by yourself depending on your OS:
- Windows:
pip3 install win10toast
- Ubuntu:
apt-get install libnotify-bin
(if don't work try searching how install notify-send for your distro of Linux)
Usage
There are to methods to use this library:
Decorator
All that you need to do is use a decorator and some specific parameters, like in the following example:
from notifier import notify
@notify(email='enmanuelmag@cardor.dev')
def your_function():
print('Hello World!')
Parameters
- title: the title of toast notification, by defult is:
Function finished
. - email: the email of user, by defult is:
None
. - api_token: the api token of your Telegram bot, by defult is:
None
. You could use BotFather to create a personal bot. - chat_id: the chat id to send the message, by defult is:
None
. If you account is public you could use your username (@username), otherwise you could use the chat id, you'll find here. - webhook_url: the url of webhook to send message to discord channel, by defult is:
None
. - msg: the message of toast notification, by default is:
Your function has finished
. - duration: the time, in seconds, that the nottications will show, by default is
8
. - urgency: the urgency of the notifcation. By defualt is
normal
. The options are:- low.
- normal.
- critical.
Class (manual call)
In this case you need to create a class and call the instance returned by the constructor, like in the following example:
from notifier import Notifier
notifier = Notifier()
notifier()
Parameters
This parameters are avaible in the class constructor and when you call the instance returned by the constructor.
- title: the title of notification, by defult is:
Manual notify
. - msg: the message of notification, by default is:
Check your code
. - email: the email of user, by defult is:
None
. - api_token: the api token of your Telegram bot, by default is:
None
. You could use BotFather to create a personal bot. - chat_id: the chat id to send the message, by defult is:
None
. If you account is public you could use your username (@username), otherwise you could use the chat id, you'll find here. - webhook_url: the url of webhook to send message to discord channel, by defult is:
None
.
Made with ❤️ by Enmanuel Magallanes
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
File details
Details for the file notify_function-1.5.0.tar.gz
.
File metadata
- Download URL: notify_function-1.5.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c631e31b946629492daf6f93a535b2becbf6fe4ea4fb693a22ced02ff3c898b6 |
|
MD5 | 96c108448a22bf214207d4172626e4d7 |
|
BLAKE2b-256 | 6f9fa5d47f656d27785a4e1424cd5d07b6b5b81dc1ce79a64453865be6ceb9f7 |
File details
Details for the file notify_function-1.5.0-py3-none-any.whl
.
File metadata
- Download URL: notify_function-1.5.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49791698ef3c6f6477796fe5081ed321cbd750c1a46b60c57e2edd52257ea1e6 |
|
MD5 | f05b9e3a1557686e80610815234ee505 |
|
BLAKE2b-256 | 8d89297b0bd6335a6ad199cd69d894d320f27275b7bc39a020e9f5541ae23127 |