Socket
Socket
Sign inDemoInstall

pytoaster

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pytoaster

Sends a telegram message to you when your code finish running


Maintainers
1

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

Toaster

A simple python library that sends you a message on your preferred channel when your code finished running or encountered an error.

Table of Contents

Getting Started

To set up Toaster, simply follow the installation and usage example.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • Preferred notification channel (Telegram account/Slack Webhook URL)
  • Python 3

Installation

  1. Install via pip
pip install pytoaster

Usage

Step 1. Import methods and configure toaster using set_config().
from toaster import telegram_toast, slack_toast, set_config

# for telegram notification
set_config(config_str=<your_telegram_id>, notification_channel='telegram')

# for slack notification
set_config(config_str=<incoming_webhook>, notification_channel='slack')

Note: You'll only have to do this once, it'll then be saved to config.json in toaster's installation path.

Step 2. Add @(channeltype)_toast above functions that you want to be notified upon completion.
# telegram example
@telegram_toast
def test_func(a,b):
    time.sleep(5)
    return 'Return {} and {}'.format(str(a),str(b))

# slack example
@slack_toast
def test_func(a,b):
    time.sleep(5)
    return 'Return {} and {}'.format(str(a),str(b))
Step 3. You'll be notified by according to your preferred channel when your code finishes executing.
- Telegram Example: Notification by @FreshToasterBot
Telegram Sample Response
- Slack Example:
Slack Sample Response

Frequently Asked Questions

1. How do I find my Telegram ID?

Get your telegram ID from @FreshToasterBot on Telegram
Start Convo

2. How do I setup my Slack Webhook?

Follow the official instructions from Slack
Slack Instructions

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgements

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc