本文整理汇总了Python中pushbullet.Pushbullet类的典型用法代码示例。如果您正苦于以下问题:Python Pushbullet类的具体用法?Python Pushbullet怎么用?Python Pushbullet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pushbullet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: checkupsstatus
def checkupsstatus():
print '\ncheckupsstatus()'
global ups_status
global battery_charge
global battery_runtime
global output_voltage
try :
#initialize pushbullet
global ACCESS_TOKEN
# if 230V is present
if ups_status == "OL CHRG":
logmessage = " OK, ups is powered"
# if power outtage is detected
elif ups_status == "OB DISCHRG" :
logmessage = time.strftime("%Y-%m-%d %H:%M:%S") + "\n panne de courant !\n Batterie a "+ str(battery_charge) +"%, "+ str(battery_runtime) +" minutes restantes."
# send message through pushbullet to user
pb = Pushbullet(ACCESS_TOKEN)
push = pb.push_note("Domini - onduleur", logmessage)
else :
# status unknow
logmessage = time.strftime("%Y-%m-%d %H:%M:%S") + "\n etat inconnu : " + str(ups_status)+ ".\n Batterie a "+ str(battery_charge) +"%, "+ str(battery_runtime) +" minutes restantes."
# send message through pushbullet to user
pb = Pushbullet(ACCESS_TOKEN)
push = pb.push_note("Domini - onduleur", logmessage)
# print message and log it
print logmessage
syslog.syslog(logmessage)
except :
logmessage = " Error while reading or parsing UPS Variables"
print logmessage
syslog.syslog(logmessage)
开发者ID:minbiocabanon,项目名称:DoMini,代码行数:34,代码来源:ups_daemonized.py
示例2: main
def main():
apikey = settings.key
users = settings.users
if apikey == '':
print('No pushbullet apikey found in pushy.conf file, or bad formatting')
input('Press enter to exit\n>>')
return
if len(users) < 1:
print('No users found in settings.py. Please specifiy at least one (main) user.')
input('Press enter to exit \n>>')
return
pb = Pushbullet(apikey)
startup = pb.push_note("Pushy Listener Initiated", "auto start on reboot")
handler = PushHandler(pb, users)
s = Listener(account=pb,
on_push = handler.receive,
http_proxy_host = Http_Proxy_Host,
http_proxy_port = Http_Proxy_Port)
try:
s.run_forever()
except (Exception, KeyboardInterrupt) as exc:
close = pb.push_note('Pushy Listener Closed', '{}'.format(exc))
else:
s.close()
开发者ID:jaemk,项目名称:pushpy,代码行数:28,代码来源:pushy.py
示例3: on_notification
def on_notification(change):
pb = Pushbullet(self.access_token)
for group in change.n_groups:
for n in group.notifications:
msg = u"Repo. : {0}\n".format(group.group_name)
msg += u"Title : {0}\nLink : {1}\nPerson : {2}\nText : {3}".format(n.title, n.link, n.person, n.text)
push = pb.push_note(u"Github Pushbullet - Notification", msg)
开发者ID:taeguk,项目名称:github_pushbullet,代码行数:7,代码来源:__init__.py
示例4: push_item
def push_item(items):
pb = Pushbullet(API_KEY)
for item in items:
if item["price"] == -1:
price_info = "No price: "
else:
price_info = str(item["price"]) + ":- | "
push = pb.push_link(price_info + item["title"], item["url"])
开发者ID:hnrklssn,项目名称:blocket-scraper,代码行数:8,代码来源:parser.py
示例5: main
def main():
im = Image.open("taehui.jpg")
g_im = im.convert('L')
g_im.save('taehui_gray.jpg', 'JPEG')
pb = Pushbullet('o.cJzinoZ3SdlW7JxYeDm7tbIrueQAW5aK')
with open('taehui_gray.jpg', 'rb') as pic:
file_data = pb.upload_file(pic, 'taehui_gray.jpg')
print(**file_data)
开发者ID:Dorry,项目名称:PyCCTV_NVR,代码行数:8,代码来源:image_test.py
示例6: _send_message
def _send_message(self, message, **kwargs):
try:
pb = Pushbullet(autosubliminal.PUSHBULLETAPI)
pb.push_note(title=self.notification_title, body=message)
return True
except Exception:
log.exception('%s notification failed', self.name)
return False
开发者ID:h3llrais3r,项目名称:Auto-Subliminal,代码行数:8,代码来源:pushbullet.py
示例7: post
def post(self):
pb = Pushbullet(API_KEY)
push = pb.push_note(title, note)
s = Listener(account=pb,
on_push=on_push,
http_proxy_host=HTTP_PROXY_HOST,
http_proxy_port=HTTP_PROXY_PORT)
开发者ID:MattTW,项目名称:HoneyAlarmServer,代码行数:8,代码来源:pushbullet.py
示例8: push_chart
def push_chart(self):
""" Pushes the chart to a Pushbullet account. """
pb = Pushbullet(config.PB_API_KEY)
with open('./today.jpg', 'rb') as pic:
file_data = pb.upload_file(pic, 'today.jpg')
pb.push_file(**file_data)
开发者ID:bcallaars,项目名称:plot-push-currency,代码行数:9,代码来源:start.py
示例9: on_change
def on_change(title, link):
title = HTMLParser().unescape(title)
api_key = read_file('api_key')
if api_key:
pb = Pushbullet(api_key.strip())
pb.push_link(title, link)
else:
print('No api_key file available. Push not sent')
开发者ID:RikardLegge,项目名称:HttpNotifications,代码行数:9,代码来源:compare.py
示例10: loop
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()
开发者ID:kionay,项目名称:miscellaneous,代码行数:9,代码来源:amaupdate.py
示例11: send_push
def send_push():
try:
title = "INTRUSION"
text = "movement detected"
from pushbullet import Pushbullet
API_KEY = 'o.nYHrQiyqBr2NTj59HaQFSSGsgoLDYQrv'
pb = Pushbullet(API_KEY)
push = pb.push_note(title,text)
except: pass
开发者ID:souryapoddar290990,项目名称:sourya,代码行数:9,代码来源:face.py
示例12: on_file_received
def on_file_received(self, file):
print "File received " + file
#super(MyHandler, self).on_file_sent(self, file)
pb = Pushbullet(api_key)
with open(file, "rb") as pic:
file_data = pb.upload_file(pic, file)
push = pb.push_file(**file_data)
开发者ID:texnofobix,项目名称:Ftp2PushBullet,代码行数:9,代码来源:ftp2pushbullet.py
示例13: send_pushbullet
def send_pushbullet(self):
pb = Pushbullet(self.pushbullet_token)
if self.file_path is not None:
with open(self.file_path, "rb") as f:
file_data = pb.upload_file(f, f.name.replace("-", ""))
response = pb.push_file(**file_data)
else:
pb.push_note("Motion detected!", "Motion detected, could not find preview image")
print "PiSN: Pushbullet notification succesfully pushed"
开发者ID:kircon,项目名称:PiSN,代码行数:9,代码来源:notification_pushbullet.py
示例14: push
def push(msg):
api_key="kO3wYXQB6WQlQp7A5AN7WcPqdMOWy1Xx"
pb = Pushbullet(api_key)
# ip = subprocess.check_output("/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'", shell=True)
devlist=[x.nickname.encode('UTF-8') for x in pb.devices]
if 'Rpi' not in devlist:
pb.new_device('Rpi')
for dev in pb.devices:
push = dev.push_note('Rpi is up! ',msg)
开发者ID:rishikanthc,项目名称:ProjectBeacon,代码行数:10,代码来源:broadcast.py
示例15: new_transaction
def new_transaction():
r = json.loads(request.data)
if r['type'] == 'transaction.created':
amount = '\u00a3{0:.2f}'.format(float(r['data']['amount'])*-1)
description = r['data']['description']
message_title = '{} spent'.format(amount, description)
message_body = '@ {}'.format(amount, description)
pb = Pushbullet(os.environ.get('pushbullet_key'))
push = pb.push_note(message_title, message)
return message
开发者ID:Manoj-nathwani,项目名称:my-mondo,代码行数:10,代码来源:app.py
示例16: send_pushbullet_message
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")
开发者ID:ligyxy,项目名称:Go-Home-Alert,代码行数:10,代码来源:main.py
示例17: cancel
def cancel(self, alert, options):
api_key = self.context.client.call_sync('alert.emitter.pushbullet.get_api_key')
pb = Pushbullet(api_key)
pb.push_note(
'Alert on {0} canceled: {1}'.format(
socket.gethostname(),
alert['title']
),
alert['description']
)
开发者ID:erinix,项目名称:middleware,代码行数:10,代码来源:PushbulletEmitter.py
示例18: push_file
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!"
开发者ID:icode-co-il,项目名称:home-security,代码行数:11,代码来源:home_security.py
示例19: Error_loop
def Error_loop():
# un peu bourrin : on boucle sur le message d'erreur + envoie d'info tant que le pb n'est pas resolu
while True :
logmessage = time.strftime("%Y-%m-%d %H:%M:%S") + "Alarme en mode ERROR !"
print logmessage
syslog.syslog(logmessage)
# send message through pushbullet to user
# initialize pushbullet
pb = Pushbullet(ACCESS_TOKEN)
push = pb.push_note("Domini - Alarme", logmessage)
time.sleep(600)
开发者ID:minbiocabanon,项目名称:DoMini,代码行数:11,代码来源:pyCaptureCam.py
示例20: pushnote
def pushnote(msg):
homeDir = os.path.expanduser('~')
configFile = os.path.join(homeDir, '.pushbullet')
config = load_config(configFile)
try:
api_key = config['pushnote']
except KeyError:
msg = '"pushnote" API key not found in config file: {}'
raise KeyError, msg.format(configFile)
pb = Pushbullet(api_key)
push = pb.push_note(msg, '')
开发者ID:nyoungb2,项目名称:NY_misc,代码行数:12,代码来源:pushnote.py
注:本文中的pushbullet.Pushbullet类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论