本文整理汇总了Python中pushbullet.Pushbullet.get_device方法的典型用法代码示例。如果您正苦于以下问题:Python Pushbullet.get_device方法的具体用法?Python Pushbullet.get_device怎么用?Python Pushbullet.get_device使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pushbullet.Pushbullet
的用法示例。
在下文中一共展示了Pushbullet.get_device方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: push
# 需要导入模块: from pushbullet import Pushbullet [as 别名]
# 或者: from pushbullet.Pushbullet import get_device [as 别名]
def push(text: str, details: str, r: praw) -> None:
"""
Push a message to computer
:param text: MNT or WNT
:param details: Match details
:param r: PRAW instance
:return: None
"""
try:
from pushbullet import Pushbullet
with open('token.txt') as files:
token = files.read().strip()
pb = Pushbullet(token)
try:
lst = text.split('?')
pb.push_note('{} match today at {} on {}'.format(details, lst[4], lst[3]),
'', device=pb.get_device('iPhone'))
except IndexError:
pb.push_note('{}{}'.format(text, details),
'', device=pb.get_device('iPhone'))
except ImportError:
lst = text.split('?')
r.send_message('RedRavens', '{} Match Today'.format(details),
'{} match today at {} on {}'.format(details, lst[4], lst[3]))
示例2: loop
# 需要导入模块: from pushbullet import Pushbullet [as 别名]
# 或者: from pushbullet.Pushbullet import get_device [as 别名]
def loop():
reduser = reddit_object.redditor("{redditor username}")
for post in reduser.submissions.new(limit=1):
if "ama" in post.title.lower() and post.id != last_ama_id:
push_bullet = Pushbullet(pushbullet_access_token)
my_phone = push_bullet.get_device("{device identifier}")
my_phone.push_note("AMA Posted","User {redditor username} is doing an AMA!")
exit()
threading.Timer(10.0,loop).start()
示例3: send_pushbullet_message
# 需要导入模块: from pushbullet import Pushbullet [as 别名]
# 或者: from pushbullet.Pushbullet import get_device [as 别名]
def send_pushbullet_message(metro_time):
from pushbullet import Pushbullet
pb = Pushbullet(conn['pushbullet_api_key'])
# If device name is provided, push to this device only
to = pb.get_device(conn['pushbullet_device']) if conn['pushbullet_device'] else pb
to.push_note("Time to go home!", "You have {0} minutes for the metro.".format(metro_time))
print("Message pushed")
示例4: push_file
# 需要导入模块: from pushbullet import Pushbullet [as 别名]
# 或者: from pushbullet.Pushbullet import get_device [as 别名]
def push_file(filename):
if is_device_connected(DEVICE_MAC):
print "Device is connected, not sending"
return
print "Sending", filename
pushbullet = Pushbullet(PUSHBULLET_API_KEY)
my_device = pushbullet.get_device(PUSHBULLET_DEVICE_NAME)
file_data = pushbullet.upload_file(open(filename, "rb"), filename)
pushbullet.push_file(device = my_device, **file_data)
print "Sent!"
示例5: main
# 需要导入模块: from pushbullet import Pushbullet [as 别名]
# 或者: from pushbullet.Pushbullet import get_device [as 别名]
def main():
with open("token.secret") as f:
token = f.read().strip()
print(token)
pb = Pushbullet(token)
# print(pb.push_note("this is title", "hoehoe"))
for d in pb.devices:
print(d.nickname)
print(d.device_iden)
myiphone = pb.get_device("yuk-iPhoneSE-g")
print(myiphone)
print(myiphone.push_note("title", "body"))
return
示例6: Pushbullet
# 需要导入模块: from pushbullet import Pushbullet [as 别名]
# 或者: from pushbullet.Pushbullet import get_device [as 别名]
from pushbullet import Pushbullet
apiKey = 'o.jsMGG789aqsV47OChBCGlPIJjQGli3Qz'
apiKeyRob = "o.uKvCG8jgepkDdoQBoUFzVJ84zCgyQ0VU"
pb = Pushbullet(apiKey)
pbRob = Pushbullet(apiKeyRob)
xperia = pb.get_device('Xperia M2')
oneplus = pbRob.get_device('OnePlus One')
def sendNotificationToMattia(title,body):
push = xperia.push_note(title, body)
def sendNotificationToRoberto(title,body):
push = oneplus.push_note(title, body)
示例7: print
# 需要导入模块: from pushbullet import Pushbullet [as 别名]
# 或者: from pushbullet.Pushbullet import get_device [as 别名]
from watchdog.observers import Observer
from watchdog.observers.polling import PollingObserver # Need to use this one if monitoring a mounted share from another computer, like the NAS
print(time.ctime() + " Starting")
SS_DIR = '/mnt/surveillance'
PB_KEY = 'YOUR_PRIVATE_PUSHBULLET_KEY'
PB_ID = 'YOUR_PUSHBULLET_ID'
AR_KEY = 'YOUR_PRIVATE_AUTOREMOTE_KEY'
#OG_FILE = '/home/bruce/mh/local/data/logs/ss_monitor.vlog.txt'
LOG_FILE1 = '/home/bruce/mh/www/ss/ss_monitor.vlog.txt'
LOG_FILE2 = '/home/bruce/mh/www/ss/ss_monitor.slog.txt'
RESTART = 6 # How many hours between restarts
pb = Pushbullet(PB_KEY)
nuc = pb.get_device(PB_ID)
def ar_to_cell (camera):
r = requests.get("http://autoremotejoaomgcd.appspot.com/sendmessage?key=" + AR_KEY + "&message=motion=:=" + str(camera))
class Camera:
list = {}
def __init__(self, name):
self.name = name
self.file_v = ''
self.time_v = 0
self.keep = 0
self.notified = 0
self.list[name] = self
def co_by_name(name):