本文整理汇总了Python中pushbullet.PushBullet.get_devices方法的典型用法代码示例。如果您正苦于以下问题:Python PushBullet.get_devices方法的具体用法?Python PushBullet.get_devices怎么用?Python PushBullet.get_devices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pushbullet.PushBullet
的用法示例。
在下文中一共展示了PushBullet.get_devices方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PushBullet
# 需要导入模块: from pushbullet import PushBullet [as 别名]
# 或者: from pushbullet.PushBullet import get_devices [as 别名]
if status['state'] == SiteState.down:
pb.push_note('Website ({0}) Unavailable'.format(site),
'%s as of %s' % (status['reason'], dt_time),
devices)
elif status['state'] == SiteState.error:
pb.push_note('Website ({0}) Offline'.format(site),
'%s as of %s' % (status['reason'], dt_time),
devices)
conf = config.read_config()
pb = PushBullet(conf['access_token'])
if '-l' in sys.argv or '--list-devices' in sys.argv:
for idx, device in enumerate(pb.get_devices()):
print('[{0}] {1}: {2}'.format(idx, *device))
elif '-a' in sys.argv or '--add-device' in sys.argv:
try:
dev_num = int(sys.argv[2])
except:
print('Incorrect usage')
print('Example: -a/--add-device NUMBER')
sys.exit()
add_device(pb, conf, dev_num)
elif '-r' in sys.argv or '--remove-device' in sys.argv:
try:
dev_num = int(sys.argv[2])
except: