使用多种服务将通知直接推送到手机
notify-push的Python项目详细描述
notify push是一个cli工具,用于将通知直接推送到手机上。
通常的系统管理方法是通过电子邮件发送警报,但是有大量的移动应用程序允许我们发送推送通知,为什么不使用那些更快和更干净的警报?
安装
只需使用pip在系统范围内安装即可:
$ sudo pip install git+https://github.com/fopina/notify-push/
或仅适用于您的用户
$ pip install --user git+https://github.com/fopina/notify-push/
用法
$ notify-push -h usage: notify-push [OPTIONS] message... Push notifications straight to your phone using multiple services positional arguments: message message optional arguments: -s SERVICE, --service SERVICE use only this service --list-services -c CONFIG, --config CONFIG use this configuration file instead of ~/.notifypush --version show program's version number and exit
当前支持的服务有:
$ notify-push --list-services notifcasterbot pushitbot
配置文件~/.notifypush:
的示例[pushitbot] token = 355aac1b7f0efe055b3f2f663cae16dd
推送消息现在非常简单:
$ notify-push hello world Pushed
或者使用stdin(对shell管道有用):
$ notify-push Press ctrl-D when done hello world Pushed $ echo hello world | notify-push Press ctrl-D when done Pushed
您还可以从其他python脚本中轻松使用它:
>>>importnotifypush>>>printnotifypush.push('hello world')True