def send_push(file):
try:
urllib3.disable_warnings()
pb = Pushbullet(API_KEY)
#push = pb.push_note(pb.devices[3]['iden'],'Alarm', 'Motion detected')
push = pb.push_note('Alarm', 'Motion detected')
print "push-uploading file.."
with open(file, 'rb') as vid:
file_data = pb.upload_file(vid, 'video.mkv')
push = pb.push_file(**file_data)
# only for debug:
#pushes = pb.get_pushes()
#latest = pushes[0]
#print latest
except Exception, error:
print "Error in send_push: " + str(error)
评论列表
文章目录