0

On executing: ntfy send 'Hello' through Windows cmd/Powershell, I am able to get a desktop notification. However, on executing the below command in Python 2.7 shell, I am getting error that 'ntfy is not recognised as internal or external command' in cmd:

>>> import os
>>> os.system('ntfy send \'hello\'')
chepner
  • 497,756
  • 71
  • 530
  • 681
kpratihast
  • 842
  • 1
  • 10
  • 23

1 Answers1

3

The ntfy library is written in Python. So, if you have installed it with pip, you can just do:

import ntfy
ntfy.notify("My message", "Title")

You can also specify a backend. Ex.:

ntfy.notify("Hi!", "Greeting", backend="telegram")
Ricardo
  • 587
  • 5
  • 14