最简单的python pushover api包装器。
pullover的Python项目详细描述
最简单的python pushover api包装器。
功能
- 无无关请求-只需快速发送非紧急消息,无需大惊小怪
- 旨在正确地掌握基本知识,并对更高级的用例的扩展持开放态度
- 如果Pushover遇到问题,则超时和自动后退
- 直观的命令行界面,具有理智、可分析的输出
- 单元和集成测试
- 签署的PYPI版本
安装
$ pip install pullover
模块
下面的代码片段演示了pullover的主要特性。有关详细的指南,请参见documentation。
高水平
importpulloverresponse=pullover.send('message','user key','app token')ifresponse.ok:print(response.id)# 647d2300-702c-4b38-8b2f-d56326ae460b
低水平
frompulloverimportApplication,User,Message,ClientSendError, \ ServerSendErrortry:aws=Application('app token')george=User('user key')message=Message('message',title='hello')response=message.send(aws,george)response.raise_for_status()print(response.id)# 647d2300-702c-4b38-8b2f-d56326ae460bexceptClientSendErrorase:# it was our faultprint(e.status,e.errors)exceptServerSendError:# Pushover is having issuesprint(e.response.text)
cli
cli支持与库相同的功能。
$ pullover -a <app_token> -u <user_key> hello! 647d2300-702c-4b38-8b2f-d56326ae460b $ export PUSHOVER_APP_TOKEN=token $ export PUSHOVER_USER_KEY=key $ pullover hello! 647d2300-702c-4b38-8b2f-d56326ae460b $ pullover --help usage: pullover [-h] [-V] [-v] -a APP -u USER [-p PRIORITY] [-t TITLE] [--timestamp TIMESTAMP] [--url URL] [--url-title URL_TITLE] message The simplest Pushover API wrapper for Python. positional arguments: message the message content to send optional arguments: -h, --help show this help message and exit -V, --version show program's version number and exit -v, --verbosity increase output verbosity -a APP, --app APP the application token to send from; defaults to PUSHOVER_APP_TOKEN -u USER, --user USER the user key to send to; defaults to PUSHOVER_USER_KEY -p PRIORITY, --priority PRIORITY the priority of the message, either an integer or string (e.g. '0' or 'normal') -t TITLE, --title TITLE the title of the message; defaults to the name of the sending application --timestamp TIMESTAMP the timestamp of the message, in ISO 8601 format; defaults to now --url URL a url to include in footer of the message --url-title URL_TITLE the URL title; requires --url