Skip to main content

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 (@usernamae), 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.

Made with ❤️ by Enmanuel Magallanes

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

notify_function-1.3.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

notify_function-1.3.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file notify_function-1.3.0.tar.gz.

File metadata

  • Download URL: notify_function-1.3.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for notify_function-1.3.0.tar.gz
Algorithm Hash digest
SHA256 9e8e5ac493ad13ae1a09246ad96e34b0af46080f33d547be58eb2f495e90cb10
MD5 8371990893fcba0b54edd1f4baecd1b4
BLAKE2b-256 32ae17171b4926c1cc0641e33d60eff609ff645243e8f7a4c58cbd1dfa9f7f1f

See more details on using hashes here.

File details

Details for the file notify_function-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: notify_function-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for notify_function-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75955b696e76e7d23670b43f4ed938883c61b876ca07443680294518d8b7a356
MD5 dd79b20ae1a5a1c0497ce651c7a1dfe4
BLAKE2b-256 3b69536ecba54a1d4051d6b57f2ced59087760ed0d36ef5973edd0543468f2b2

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