本文整理汇总了Python中pushbullet.PushBullet.get方法的典型用法代码示例。如果您正苦于以下问题:Python PushBullet.get方法的具体用法?Python PushBullet.get怎么用?Python PushBullet.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pushbullet.PushBullet
的用法示例。
在下文中一共展示了PushBullet.get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: notifyPushbullet
# 需要导入模块: from pushbullet import PushBullet [as 别名]
# 或者: from pushbullet.PushBullet import get [as 别名]
def notifyPushbullet(downlist):
"""
"""
#prepare the interface
pb = PushBullet(config.get("pushbullet_api_key"))
devices = []
#identify desired targets
for device in pb.devices:
devicename = device.name
deviceno = device.device_id
target = config.get("pushbullet_target_dev")
if target is not "":
if target == devicename:
devices.append(deviceno)
else:
devices.append(deviceno)
#prepare message
message = "The host(s): \n"
for dom in downlist:
message += " "+dom+" \n"
message += "seems to be down."
#actually push the messages
for deviceno in devices:
device = pb.get(deviceno)
push = device.push_note("server monitor", message)
if (push is None) or (push.status_code is not 200):
return False
return True