易于使用的Web推送通知库
python-webnoti的Python项目详细描述
易于使用的python web推送通知库
安装
使用pip安装:
$ pip install python-webnoti
用法
发送通知:
fromwebnotiimportsend_notification,get_private_keysend_notification(subscription,"Hello from server")# For Firefoxsend_notification(subscription,"Hello from server",# For Chrome'mailto:admin@example.com',get_private_key('privkey.pem',generate=True))# subscription can be obtained from the client.
手动生成私钥:
fromwebnotiimportget_private_keyget_private_key('privkey.pem',b'password',generate=True)
这将在当前工作目录中生成名为privkey.pem的私钥,密码为password(如果未加密,则为none)。
签出python-webnoti-example 举个完整的例子。