Esempio n. 1
0
class SendSMS(object):
    def __init__(self):
        self.__driver_()
        pass

    def __initialize_clinet_(self):
        self.client = Pushbullet(cr.PUSHBULLET_API_KEY)
        pass

    def __driver_(self):
        self.contactObj = ContactDriver()
        self.__initialize_clinet_()
        pass

    def send(self, message, contactName):
        contact_number = self.contactObj.fetch_contact(contactName)
        print(contact_number)
        number = str(contact_number['PHONE'].values[0])
        number = number.replace(" ", "")

        print(number)
        device = self.client.devices[0]

        self.client.push_sms(device, number, message)
        pass
def sms(phone,name):
    try:
        phone = '+91'+phone
        msg = name.upper() + " is marked present at " + timeStamp + " on " + date
        pb = Pushbullet('o.2cvqqDnts32P4eD8DN5vjFOwBCXU9GzD')
        print(pb.devices)
        device = pb.devices[0]
        pb.push_sms(device, phone, msg)
    except:
        return
Esempio n. 3
0
 def notify(self, match_results: Tuple[MatchResult, ...]):
     push_bullet_client = Pushbullet(self.token)
     for match_result in match_results:
         device = push_bullet_client.devices[self.device_id]
         push_bullet_client.push_sms(
             device, match_result.giver.communication_address,
             MESSAGE_TEMPLATE.format(
                 giver_name=match_result.giver.name,
                 taker_name=match_result.taker.name,
                 poll_link=self.poll_link,
             ))
         time.sleep(self.interval_gap_between_messages)
Esempio n. 4
0
 def pushbullet_notification(self):
     pb = Pushbullet("o.xgWW2FkTk3pGt2oQXM9m9TiQXF2GvUPQ")
     phone = pb.devices[0]
     phone = pb.get_device('OnePlus 7 Pro')
     if self.typeOfNotification == "notification":
         push = phone.push_note("Alert!", self.msg)
     elif self.typeOfNotification == "sms":
         push = pb.push_sms(phone, "+4521378019", self.msg)
Esempio n. 5
0
def pushbullet_notification(notificationType, message):
    pb = Pushbullet("o.xgWW2FkTk3pGt2oQXM9m9TiQXF2GvUPQ")
    # Get all devices that the current user has access to.
    # Select a device
    phone = pb.devices[0]
    phone = pb.get_device('OnePlus 7 Pro')
    if notificationType == "notification":
        push = phone.push_note("Alert!", message)
    elif notificationType == "sms":
        push = pb.push_sms(phone, "+4521378019", message)
Esempio n. 6
0
#Get all devices that the current user has access to.
print(pb.devices)

#Get a device
dev = pb.get_device("Galaxy S7 Edge")

#1. Push Notification
push = dev.push_note("Alert!", "This PUSH-notification sent from Raspberry!")

# push is a dictionary containing the data returned by the Pushbullet API.
print('A dictionalry after 1:')
print(push)

#2. SMS-message
push = pb.push_sms(dev, "+31612345678", "This SMS sent from Raspberry!")
print('A dictionalry after 2:')
print(push)

#3. Push a file from file system
with open("thief.jpg", "rb") as pic:
    file_data = pb.upload_file(pic, "picture.jpg")
push = pb.push_file(**file_data)
print('A dictionalry after 3:')
print(push)

#4. Push a file already uploaded somewhere
push = pb.push_file(file_url="https://i.imgur.com/IAYZ20i.jpg",
                    file_name="cat.jpg",
                    file_type="image/jpeg")
print('A dictionalry after 4:')
Esempio n. 7
0
    else:
        print 'complete sending'


while True:
    i = GPIO.input(pin_input)
    if i == 1:
        GPIO.setup(pin_input, GPIO.IN)
        print("Niveau OK")
        sleep(2)
        GPIO.output(pin_relay, False)
    elif i == 0:
        print("Niveau d'eau atteint")
        gsm1 = pb.get_device('iPhone de TTTTT')
        push = gsm1.push_note("Alert !!", "Niveau d'innondation atteint")
        #push = pb.push_sms(gsm1, "+32476123456", "Alert innondation !!!")
        gsm2 = pb.devices[0]
        #myriam = pb.contact[0]
        #push = myriam.push_note("Alert !!", "Niveau d'innondation atteint")
        print(gsm2)
        push = pb.push_sms(gsm2, "+32477123456", "Alert innondation !!!")
        #push = gsm2.push_note("Alert GSM2!!", "Niveau d'innondation atteint")
        #push = pb.push_note("Hello world!", "We're using the api.", contact="zzzzz")
        send_notification_via_pushbullet("Alert innondation!!",
                                         "Niveau d'innodation atteint")
        #contacts = pb.getContacts()
        #print(contacts)
        #pushNote(self, "*****@*****.**", "Alert!!!", "Niveau atteint", recipient_type="device_iden")
        sleep(2)
        GPIO.output(pin_relay, True)