Skip to main content

Notifly

Code Usage

PyPI PyPI - Downloads Discord

Logo

Table of Contents

About the package

Simple Bots to push notifications during an event trigger.

"Telegram" wrapper to send messages, images, files over the bot using API.
"Discord" wrapper to send message, images, files to the channel using Webhooks.
"Slack" 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,

  1. Create the telegram bot.
  2. Getting the bot API token
    1. Search and go to _@Botfather_ .
    2. Message /mybots .
    3. Select the bot.
    4. Select the API token displayed in message.
    5. 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
    
  3. Run sample code.

Discord

To see how the tool works,

  1. Create server.
  2. 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
    
  3. Run sample code.

Slack

To see how the tool works,

  1. Create app. Follow these steps,
    1. Go here.
    2. Go to Create an App .
    3. Enter App Name and select workspace. Click Create App.
    4. Under Add features and functionality select Incoming Webhooks and Activate Incoming Webhooks.
    5. 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. Click Allow.
    6. Select OAuth & Permissions from left-sidebar.
    7. Under Scopes > Bot Token Scopes click Add an OAuth Scope and add the following scopes,
      chat:write   chat:write.public   files:write   users:write
    8. Scroll up, under OAuth Tokens for Your Team copy the Bot User OAuth Access Token to use in sample code.
    9. Click Reinstall to Workspace, select channel and click Allow.
  2. 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
    
  3. 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

  1. Fork the Project
  2. Create your Feature Branch

    git checkout -b feature/mybranch

  3. Commit your Changes

    git commit -m 'Add something'

  4. Push to the Branch

    git push origin feature/mybranch

  5. Open a Pull Request

    Follow the given commands or use the amazing GitHub GUI
    Happy Contributing

Metadata

Release files for notifly 1.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for notifly 1.3.3
File Size Uploaded Provenance
notifly-1.3.3.tar.gz 13.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for notifly 1.3.3
File Interpreter ABI Platform
notifly-1.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 24.5 kB

Release files / notifly-1.3.3.tar.gz

Download URL notifly-1.3.3.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
884448da9bbf27338bbbf073d206cbf221e6b6da83637d2b0d03d262e18ad118
BLAKE2b-256 checksum
How to use checksums
ab4972df59858bd472ccc77b6416356bf550dfda055dee64cca52aeba4aefe0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / notifly-1.3.3-py3-none-any.whl

Download URL notifly-1.3.3-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0056b922d5c125398a56ddf26629d513959a637d31c408e91ecef5bef96ba36c
BLAKE2b-256 checksum
How to use checksums
25d84f0b39a0109629f8d904c2fb0ccd43734a25fc38fa0f14adc5973df4e1a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Security for notifly 1.3.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page