Want to get notified on your phone when your code has executed? This is a simple tool to generate a Push Notification to your IFTTT app.
Now available to download through PyPi.
pip install pushnotif
- Sign up for an IFTTT account.
- Go to the Create section.
- Click on Add for If This and choose "Webhooks".
- Choose the first option for Receive a web request.
- Give this event any name, for example, "Notifier", and click on Create triger.
- Click on Add for Then That and choose "Notifications".
- Click on the first option for Send a notification from the IFTTT app.
- Type a message that you want to accompany your notification. Here, you can also add an option for sending variables from runtime when you run code. Click on Add ingredient and choose any of the three Value variables. You can also use the EventName to add the name of the event in the notification and OccurredAt to get the time when the event occurred.
For example,
{{EventName}} : Your Code has executed with message {{Value1}} at {{OccurredAt}}
Notifier : Your Code has executed with message "Model Finished Training" at September 9, 2021 at 07:51PM
- Click on Continue. Write a Title for your Applet and click on Finish.
- Go to the Webhook Documentations to get your key. You will use this key to intialize your code.
pip install pushnotif
Run the following with your event name (Step 5) and key (Step 10) that you got when setting up IFTTT,
from pushnotif import PushNotif
handler = PushNotif(key = <your_key>, event = <your_event>)
...
model.fit(...)
...
handler.send("Model Trained")
You can put the handler.send()
method at the end of any cell you want to be notified for after execution.