Notification on the fly !
Project description
Notifly
Code Usage
Table of Contents
About the package
Simple Bots to push notifications during an event trigger.
wrapper to send messages, images, files over the bot using API.
wrapper to send message, images, files to the channel using Webhooks.
wrapper to send message, images, files to the channel using API.
Built With
Prerequisites
- Python
It is preinstalled in Ubuntu 20.04. To check the version use command :
python3 --version
If it is not preinstalled for some reason, proceed here and download as per requirement.
Run the following command in terminal to download the required packags for running the tool locally :
- Using requirements file :
pip3 install -r requirements.txt
- Directly download packages:
pip3 install requests==2.24.0
pip3 install matplotlib==3.2.2
pip3 install slackclient==2.9.3
Install the package
Run the following terminal commands to install the package on the given distros.
- Termux :
pkg install python3
pip3 install notifly
- Ubuntu/Debian
sudo apt install python3-pip
pip3 install notifly
- Arch
sudo pacman -S python3-pip
pip3 install notifly
This may take a while depending on the network speed.
Working of the tool
Telegram
To see how the tool works,
- Create the telegram bot.
- Getting the bot API token
- Search and go to
_@Botfather_
. - Message
/mybots
. - Select the bot.
- Select the API token displayed in message.
- Copy and use in sample code.
from notifly import telegram #import the package x = telegram.Notifier('bot API token') #create object of class Notifier x.send_message('message') #send message x.send_image("image address") #send image(.jpg or .png format) x.send_file("file address") #send document x.session_dump() #creates folder named 'downloads' in local folder, downloads/saves message,chat details for current session in 'sessio_dump.json' file
- Search and go to
- Run sample code.
Discord
To see how the tool works,
- Create server.
- Create and copy server webhook and use in sample code.
from notifly import discord x = discord.Notifier(r'webhook') #create object of class Notifier x.send_message('message') #send message x.send_file("file address") #send file x.send_file("image address") #send image
- Run sample code.
Slack
To see how the tool works,
- Create app. Follow these steps,
- Go here.
- Go to
Create an App
. - Enter App Name and select workspace. Click
Create App
. - Under Add features and functionality select
Incoming Webhooks
and Activate Incoming Webhooks. - Scroll down, select
Add New Webhook to Workspace
and select a channel from the drop down.This channel name is used as an argument in the sample code. ClickAllow
. - Select OAuth & Permissions from left-sidebar.
- Under Scopes > Bot Token Scopes click
Add an OAuth Scope
and add the following scopes,chat:write
chat:write.public
files:write
users:write
- Scroll up, under OAuth Tokens for Your Team copy the Bot User OAuth Access Token to use in sample code.
- Click
Reinstall to Workspace
, select channel and clickAllow
.
- Write sample code.
from notifly import slack x= slack.Notifier('token', channel='channel-name') #create object of class Notiflier x.send_message('message') #send message x.send_file("image or file address") #send image/file
- Run sample code.
Tensorflow Integration
Plug and play feature for your tensorflow callbacks
# create your notifier using above methods
from notifly import discord
notifier = discord.Notifier(r'webhook')
class MyNotifierCallback:
@notifier.notify_on_epoch_begin(epoch_interval=1, graph_interval=1, hardware_stats_interval=1)
def on_epoch_begin(self, epoch, logs=None):
pass
@notifier.notify_on_epoch_end(epoch_interval=1, graph_interval=1, hardware_stats_interval=1)
def on_epoch_end(self, epoch, logs=None):
pass
@notifier.notify_on_train_begin()
def on_train_begin(self, logs=None):
pass
@notifier.notify_on_train_end()
def on_train_end(self, logs=None):
pass
model.fit(callbacks=[MyNotifierCallback()])
Learn more about Notifly ✨
Read the wiki pages which has all the above steps in great detail with some examples as well 🤩🎉.
Contributing
- Fork the Project
- Create your Feature Branch
git checkout -b feature/mybranch
- Commit your Changes
git commit -m 'Add something'
- Push to the Branch
git push origin feature/mybranch
- Open a Pull Request
Follow the given commands or use the amazing GitHub GUI
Happy Contributing
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file notifly-1.3.2.tar.gz
.
File metadata
- Download URL: notifly-1.3.2.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b5e5738b5de28350f8f22e107f33300d24ab4f7d4c8277c5484366a23035523 |
|
MD5 | a6106f4be70959b3d42e72bbb6dba7d4 |
|
BLAKE2b-256 | ea53bfb5c17a69e13f75118acf1f5fbd8cd649129955f528caa5607f1f462af1 |
File details
Details for the file notifly-1.3.2-py3-none-any.whl
.
File metadata
- Download URL: notifly-1.3.2-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55f9bd6c11d88b7bb35e8a195b9a550a5bd47638d2dc781df7533c9ab7c32d19 |
|
MD5 | cfbe1a8906128ef0df9e8787ab68197a |
|
BLAKE2b-256 | e6d57178b4a64de8ebf42a2ff6d6bafb43f359d8f5ff94e0af4aef78ebafa31e |