Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whendone-1.2.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

whendone-1.2.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

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

Hashes for whendone-1.2.0.tar.gz
Algorithm Hash digest
SHA256 95fc5cc42090570dacff6175e748e6b85f04b563c7d883430ad2df119ed71aa8
MD5 d5e70a98a543f5075f9b343cd1fbc823
BLAKE2b-256 a63d02cba67329989e04e497467a1dd9168f9fed3e29d00545e6bba923aaaa75

See more details on using hashes here.

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

Hashes for whendone-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5e232e0d41368340c517e557297e0f4e0c8bac11a34e540b520b3b07dfc2f03
MD5 8aab5bb2a134df33f574c8a1bae5e141
BLAKE2b-256 1174445f0eb322d2c543b521e02d6a1abc6ce139353b08161f9cb110feaa185e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page