本文整理汇总了Python中pushbullet.PushBullet.pushList方法的典型用法代码示例。如果您正苦于以下问题:Python PushBullet.pushList方法的具体用法?Python PushBullet.pushList怎么用?Python PushBullet.pushList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pushbullet.PushBullet
的用法示例。
在下文中一共展示了PushBullet.pushList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pushList
# 需要导入模块: from pushbullet import PushBullet [as 别名]
# 或者: from pushbullet.PushBullet import pushList [as 别名]
def pushList(args):
p = PushBullet(args.api_key)
lst = p.pushList(args.device, args.title, args.list)
if args.json:
print(json.dumps(lst))
return
print("List %s sent to %s" % (lst["iden"], lst["target_device_iden"]))
示例2: pushList
# 需要导入模块: from pushbullet import PushBullet [as 别名]
# 或者: from pushbullet.PushBullet import pushList [as 别名]
def pushList(args):
p = PushBullet(args.api_key)
lst = p.pushList(args.device, args.title, args.list)
if args.json:
print(json.dumps(lst))
return
if args.device and args.device[0] == '#':
print("List broadcast to channel %s" % (args.device))
elif not args.device:
print("List %s sent to all devices" % (lst["iden"]))
else:
print("List %s sent to %s" % (lst["iden"], lst["target_device_iden"]))
示例3: pushList
# 需要导入模块: from pushbullet import PushBullet [as 别名]
# 或者: from pushbullet.PushBullet import pushList [as 别名]
def pushList(args):
p = PushBullet(args.api_key)
try:
lst = p.pushList(args.device, args.title, args.list)
except HTTPError:
_, e, _ = sys.exc_info()
print("The server couldn\'t fulfill the request.")
print("Error code: %s" % (e.code))
except URLError:
_, e, _ = sys.exc_info()
print("We failed to reach a server.")
print("Reason: %s" % (e.reason))
else:
if args.json:
print(lst)
return
if "created" in lst:
print("OK")
else:
print("ERROR %s" % (lst))