向移动设备发送通知

notifyourself的Python项目详细描述


通知我们自己

notifyourselfcli使向手机发送通知变得简单。只需遵循以下简单步骤:

  • 在发送计算机上安装notifyourselfcli
  • 从Play Store安装NotifyourSelf Android应用程序或自行编译它
  • 在应用程序的配置页中查找您的令牌
  • 运行notifyourself -T <token> "Hello yourself!"向自己发送通知

当您的长跑模拟、nn训练或计算完成时,您可以使用此功能向自己发送一条消息:

$ longRunningCalculation.sh && notifyourself "Job finished :)"

安装

只需使用pip安装notifyourself:

$ python -m pip install notifyourself

使用源目录

您也可以直接使用python script source;确保安装requests包:python -m pip install requests

配置

配置是使用文件~/.config/notifyourself/config.ini(或windows上的%USERPROFILE%\.config\notifyourself\config.ini)完成的。

# notifYourself configuration## You can define multiple targets with different tokens and use# the -t flag to choose one. Default is the DEFAULT target.[DEFAULT]# Use your notifYourself app to find this tokentoken=# [ANOTHER_TARGET]# token=ANOTHER_TARGETS_TOKEN

用法

usage: notifyourself [-h] [-T TOKEN | -t TARGET] [--config CONFIG]
                     title [body]

Send a notification to your phone

positional arguments:
  title                 Notification title
  body                  Longer message in the body of the notification

optional arguments:
  -h, --help            show this help message and exit
  -T TOKEN, --token TOKEN
                        Use this token to send the message
  -t TARGET, --target TARGET
                        Send message to this target phone specified in the
                        config file
  --config CONFIG       Configfile to use instead of default

示例

  • 发送带有通知的简短结果
$ echo "42" > ./result
$ notifyourself "Job's finished :)" "Result: $(cat ./result)"
  • 更改标记
$ notifyourself -T "longlong:token-foobar" "It works :)"
  • 预先配置多部手机
$ cat ~/.config/notifyourself/config.ini 
# notifYourself configuration
#
# You can define multiple targets with different tokens and use
# the -t flag to choose one. Default is the DEFAULT target.

[DEFAULT]
# Use your notifYourself app to find this token
token=foobarbaz1

[ANOTHER_TARGET]
token=target2token

$ notifyourself -t ANOTHER_TARGET "This shows in the other one"

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何按顺序显示父节点属性值和关联的子节点属性值?   java Zip 2在Spring Webfux中的不同Mono   java Twitter oauth_签名创建   SpringBoot中未标识java自定义依赖项   如何使用Java访问netbeans中的json Post方法值   在Java中查找数字的位数之和   java Hibernate使用date where子句过滤单列数据   java Spring@ExceptionHandler未捕获AccessDeniedException   java如何知道bean是否有一些值   javavaadin谷歌描述   javafx如何修复“java未命名模块从y和z读取程序包x”   Java generictyped方法返回错误的类型   java Android从应用程序发送电子邮件崩溃电子邮件强制关闭   Java与C版本的相同算法   Java编程异常   java动态生成收据   java使用ACRCloud将音频记录保存在文件中   java在注册到web应用程序后激活帐户   Java数组删除最后存储的元素