可从https://pushnotifier.de轻松使用服务的python包/
pushnotifier的Python项目详细描述
python的pushnotifier(v2)
在python项目中轻松使用PushNotifier服务的python模块。
特别感谢前往@Logxn。
关于
轻松发送
- 信息
- 网址
- 图像
通过python连接到所有设备。有关详细信息,请访问pushnotifier.de
安装
注意:必须安装requests
(pip install requests
)
通过pip安装pushnotifier
$ pip install pushnotifier
手动安装PushNotifier
$ git clone https://github.com/tomg404/pushnotifier-python $cd /path/to/repository/ $ python setup.py install
用法
frompushnotifierimportPushNotifieraspnpn=pn.PushNotifier('username','password','package_name','api_key')
发送消息
>>>pn.send_text('hello world',silent=False,devices=['abcd','efgh'])>>>pn.send_url('https://www.example.com',silent=False,devices=['abcd','efgh'])>>>pn.send_notification('hello world','https://www.example.com',silent=False,devices=['abcd','efgh'])>>># Note on send_image: currently you can't send images to android/ios devices>>>pn.send_image('path/to/image.png',silent=False,devices=['abcd','efgh'])
获取基本信息
>>>password='XXXXX'>>>pn.login(password){'username':'username','avatar':'https://gravatar.com/avatar/XXXXX','app_token':'XXXXX','expires_at':XXXXX}>>>pn.get_all_devices()['abcd','efgh','ijkl']
刷新应用程序令牌
>>>pn.refresh_token()'new_token'
更详细的帮助
>>>help(pn.some_method_you_need_help_on)