DEV Community

Cover image for Notifier Function Status
Enmanuel Magallanes Pinargote
Enmanuel Magallanes Pinargote

Posted on • Originally published at enmanuelmag.cardor.dev

Notifier Function Status

This library provides a decorator to show a toast in your screen and if you setup, send a email when your function end. All that you need to do is use a decorator and some specific parameters, like in the following example:

from notifier import notify

# Send a message to telegram
@notify(api_token='your_api_token', chat_id='your_chat_id')
def your_function():
    print('Hello World!')
Enter fullscreen mode Exit fullscreen mode

Another way is by manually calling the function:

from notifier import Notifier

notifier = Notifier(
  title='Execution for',
  api_token='your_api_token'
  chat_id='your_chat_id'
)

for i in range(10):
    notifier(msg=f'Hello World {i}!')

# You can also override all the previous parameters,
# on the constructor, by passing them to the function
notifier(title='Execution done', msg='Finished!')
Enter fullscreen mode Exit fullscreen mode

Check these features a more detailed on the GitHub repository.

Tech used

  • Python
  • Telegram API
  • Discord webhooks

Top comments (0)