[PYTHON] Push notifications to your smartphone from the Linux command line or scripts. (Introduction of a tool called ntfy)

I would like to introduce ntfy because it was convenient.

With ntfy, you can easily send push notifications to various apps from the Linux command line or scripts. Written in Python. I support a lot, but I tried the following three:

-Pushover (It's convenient, but the app costs about 500 yen. Isn't it cheap if you can buy peace of mind at this price?) -slack (I think it's useful if your team uses slack.) -Pushbullet (The Chrome browser app can be used, but the smartphone app was not good so far.)

As a result, Pushover was necessary and sufficient, so I use Pushover.


Easy to install with pip.

pip install ntfy

#When using slack
pip install ntfy[slack]

Prepare ~ / .ntfy.yml

Get token and ʻuser_key from the setting screen of the application you are using and write it in ~ / .ntfy.yml` as follows.

    - pushover
    - slack
    - pushbullet
    user_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    recipient: "#general"
    access_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Try using

#Simply push notification
ntfy -t 'Test' send "This is a test."

#Notify when the command finishes(Example: sleep command)
ntfy done sleep 10

If the settings are correct, the app will be notified. (The -t option is the title of the message.)

Try using it from python code (eg Pushover)

>>> import ntfy
>>> ntfy.backends.pushover.notify(title="Test", message="This is a test.", user_key="XXXXXXXXXXXXXXXXXXXX")


Useful for fault alerts and time-consuming batch job execution.

Recommended Posts

Push notifications to your smartphone from the Linux command line or scripts. (Introduction of a tool called ntfy)
Open Chrome version of LINE from the command line [Linux]
How to display a specified line of a file or command result on Linux (sed, awk)
How to output the output result of the Linux man command to a file
From the introduction of pyethapp to the execution of contract
The best tool to protect your privacy from your photos ...!
How to create an article from the command line
(Remember quickly) How to use the LINUX command line
A Python script that allows you to check the status of the server from your browser
Search for large files on Linux from the command line
After all, the story of returning from Linux to Windows
#The command to check the encoding of a text file (ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8 or UTF-16) on Linux is nkf --guess (forget every time)
A super introduction to Linux
[Linux] I tried to summarize the command of resource confirmation system
[Introduction to StyleGAN] I played with "The Life of a Man" ♬
How to get a string from a command line argument in python
[Go] Create a CLI command to change the extension of the image
[EC2] How to install and download chromedriver from the command line
How to extract the desired character string from a line 4 commands
A command to easily check the speed of the network on the console
From the introduction of JUMAN ++ to morphological analysis of Japanese with Python
Create a command line tool to convert dollars to yen using Python