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
- 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
- Slack Example:
Frequently Asked Questions
1. How do I find my Telegram ID?
Get your telegram ID from @FreshToasterBot on Telegram
2. How do I setup my Slack Webhook?
Follow the official instructions from Slack
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.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE for more information.
Acknowledgements
- Gal Shir for his cute toaster design https://galshir.com/
Metadata
Release files for pytoaster 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytoaster-0.0.7.tar.gz | 5.0 kB | Without provenance | Details for pytoaster-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytoaster-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for pytoaster-0.0.7-py3-none-any.whl |
Total release size: 10.9 kB
Release files / pytoaster-0.0.7.tar.gz
| Download URL | pytoaster-0.0.7.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43b0184859d18f608700fd84e4765186a5d44d0cec230472d0550db54760fdf1
|
|
BLAKE2b-256 checksum How to use checksums |
b23acf1197453dab6b4287ea542c7732bd65755098864d6ec26c883cdc651dd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.0
|
Release files / pytoaster-0.0.7-py3-none-any.whl
| Download URL | pytoaster-0.0.7-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f6736cbab7f38d06d56ab6f2bd863f67ba2487927ef32a11a20e77ccfca05fba
|
|
BLAKE2b-256 checksum How to use checksums |
9ddb6a4d5b61b3befb360d52b80b0adb80551a6d444acbe6fa97e1319594b699
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.0
|
Security for pytoaster 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.