Exemple #1
0
def run():
    voice = Voice()
    voice.login()
    for msg in voice.sms().messages:
        if msg.phoneNumber == "+13145918660":
            msg.mark(0)
            print('marked')
Exemple #2
0
  def post(self):
    if users.get_current_user() is None:
      self.redirect('/')

    key = self.request.get('id', '')
    if key == '':
      self.error(400)
      return

    try:
      phone = Phone.all().filter('user ='******'__key__ =', db.Key(key)).get()

      phone.code = Phone.generate_code()
      phone.code_time = datetime.datetime.now()
      phone.put()

      v = Voice()
      v.login()
      v.send_sms(phone.number, phone.code)

    except db.BadKeyError:
      self.error(400)
      return;
      
    self.redirect('/phone/verify?id=%s' % key)    
Exemple #3
0
class Connection(SuperConn):
    """Manages connection with Google Voice"""
    
    def get_messages(self):
        """Retrieve messages from GV connection and return MessageSet instance"""
        return gv_convos_to_messages(self)
        
    def send(self,msg):
        """Send a message using this GV connection."""
        #Should we check if it's sending a message to itself?
        
        self.check_num_format(msg.to_num) #raises exception if not right format
        
        self.voice.send_sms(msg.to_num,msg.text)
        
    def __init__(self,cid,**creds):
        """Connection to Google Voice.
        optional keyword args:
            GV_USER=<str>, GV_PASSWORD=<str>
        (if none provided will prompt)"""
        
        self.voice = Voice()
        print "logging in to GV account %s" % creds['GV_USER']
        self.voice.login(email=creds['GV_USER'],passwd=creds['GV_PASSWORD'])
        self.id = cid
        self.num = self.voice.settings['primaryDid']
        self.backend = 'pygooglevoice'
        
    def __delete__(self):
        self.voice.logout()
Exemple #4
0
class Google_Voice(StateDevice):
    STATES = [State.UNKNOWN, State.ON, State.OFF]
    COMMANDS = [Command.MESSAGE]

    def __init__(self, user=None, password=None, *args, **kwargs):
        self._user = user
        self._password = password
        print "big"
        self._create_connection(user, password)
        super(Google_Voice, self).__init__(*args, **kwargs)

    def _create_connection(self, user, password):
        print "ehehe"
        self._voice = Voice()
        print 'user' + user + ":" + password
        self._voice.login(email=user, passwd=password)

    def _initial_vars(self, *args, **kwargs):
        super(Google_Voice, self)._initial_vars(*args, **kwargs)

    def _delegate_command(self, command, *args, **kwargs):
        self._logger.debug('Delegating')
        print 'pie'
        print str(args) + ":" + str(kwargs)
        if isinstance(command, tuple) and command[0] == Command.MESSAGE:
            self._logger.debug('Sending Message')
            self._voice.send_sms(command[1], command[2])

        super(Google_Voice, self)._delegate_command(command, *args, **kwargs)
Exemple #5
0
def run():
    voice = Voice()
    voice.login()

    voice.sms()
    for msg in extractsms(voice.sms.html):
        print(msg)
Exemple #6
0
 def run():
     voice = Voice()
     voice.login()
     phoneNumber = "2062406946"
     text = secret_word
     voice.send_sms(phoneNumber, text)
     print ("Sent "+ secret_word)
def main():
	voice = Voice()
	voice.login()

	while 1:
		print "Starting loop\n" ### 
		for message in voice.inbox().messages:
			# Get text
			msg = message['messageText']
			phoneNumber = message['phoneNumber']
			
			# Pass to appropriate handler
			keyword = msg.split(" ")[0].lower()
			print "Keyword: %s\n\n"%keyword ###
			if keyword in handlers:
				replies = handlers[keyword](phoneNumber, msg)
			else:
				replies = {phoneNumber:"Command not found. Try these: %s"%(str(handlers.keys()))}			

			print "Replies: %s\n\n"%replies ###
			for phoneNum in replies:
				voice.send_sms(phoneNum, replies[phoneNum])	

			message.delete()
		time.sleep(1)
Exemple #8
0
def returnmessage(phone):
    response = open('response.txt', 'r')
    message = response.readline()
    gvoice = Voice()
    gvoice.login()
    gvoice.send_sms(phone, message)
    response.close()
def getSMS(queue):

	voice = Voice()
	print "logging in..."
	voice.login("*****@*****.**","ColdplaY1*")
	print "logged in..."


	while True:	
		#sleep(60)
		voice.sms()
		tree = BeautifulSoup(voice.sms.html)
		unread = tree.find("div",attrs={"class":"goog-flat-button gc-message gc-message-unread gc-message-sms"})
		try:
			thread = unread.find("div",attrs={"class":"gc-message-message-display"})
			rows = thread.findAll("div",attrs={"class":"gc-message-sms-row"})
			row=rows[len(rows)-1]
			sender = ''.join(row.find("span",attrs={"class":"gc-message-sms-from"}))
			if re.search("Watson",sender):
				message = ''.join(row.find("span",attrs={"class":"gc-message-sms-text"})).strip(' \t\r\n')
				message = "Sherlock "+message
				print 'putting',message
				queue.put(message)
				#indicate this came from sms
				queue.put("SMS")
			print 'marking as read'
			while True:
				folder = voice.search('is:unread')
				if folder.totalSize <= 0 :
					break
				for message in folder.messages:
					message.mark(1)
			print 'done marking as read'
		except:
			return
Exemple #10
0
class GoogleVoice:
    def __init__(self, email, password):
        self.handle = Voice()
        self.handle.login(email, password)

    def send(self, dstNumber, msg):
        self.handle.send_sms(dstNumber, msg)
Exemple #11
0
def run():
    voice = Voice()
    voice.login()

    for message in voice.sms().messages:
        if message.isRead:
            message.delete()
Exemple #12
0
def start_crawl():
    """
        Run this to begin the crawl!
        Keep in mind participants form must have this format: Timestamp (google adds this automatically), Name, and phone number
        Keep in mind hosts form must have this format: Stop College, Location, Drink Name
        ** Also, your password to your google account will be echoed on the command line. **
        
        If you are not on Aaron's computer and are looking to get the necessary python packsages... you need:
            pygooglevoice
            gdata-python-client
            BeautifulSoup
        
        Happy crawling!
    """
    email = raw_input('What is your Google Account?') # voice and docs must be same acct
    password = raw_input('What is your Google Password')
    hosts_name = raw_input('What is the name of your GoogleDocs Host Spreadsheet')
    participants_name = raw_input('What is the name of your GoogleDocs Participants Form')
    _organizer_number = raw_input('What is the phone number of the crawl organizer? (10 digit number)')
    organizer_number = '+1'+_organizer_number+':'
    num_stops = raw_input('What is the number of stops')
    
    gd_client = gdata.spreadsheet.service.SpreadsheetsService()
    gd_client.email = email
    gd_client.password = password
    gd_client.source = 'Insta-Crawl'
    gd_client.ProgrammaticLogin()
    
    hosts = _getSpreadsheetRows(hosts_name, gd_client)
    participants = _getSpreadsheetRows(participants_name, gd_client)
    
    voice = Voice()
    voice.login(email, password)
    
    _start_poll(organizer_number, hosts, participants, num_stops, voice)
Exemple #13
0
def run():
    voice = Voice()
    voice.login()

    voice.sms()
    for msg in extractsms(voice.sms.html):
        print(msg)
Exemple #14
0
class Google_Voice(StateDevice):
    STATES = [State.UNKNOWN, State.ON, State.OFF]
    COMMANDS = [Command.MESSAGE]

    def __init__(self, user=None, password=None, *args, **kwargs):
        self._user = user
        self._password = password
        self._create_connection(user, password)
        super(Google_Voice, self).__init__(*args, **kwargs)

    def _create_connection(self, user, password):
        self._voice = Voice()
        self._logger.debug('user' + user + ":" + password)
        self._voice.login(email=user, passwd=password)

    def _initial_vars(self, *args, **kwargs):
        super(Google_Voice, self)._initial_vars(*args, **kwargs)

    def _delegate_command(self, command, *args, **kwargs):
        self._logger.debug('Delegating')
        self._logger.debug(str(args) + ":" + str(kwargs))
        if isinstance(command, tuple) and command[0] == Command.MESSAGE:
            self._logger.debug('Sending Message')
            self._voice.send_sms(command[1], command[2])

        super(Google_Voice, self)._delegate_command(command, *args, **kwargs)
Exemple #15
0
def TogglePhones(log_file, actions):
  voice = Voice()
  voice.login()
  exceptions = []
  for phone in voice.phones:
    if phone.phoneNumber in REVERSE_NUMBERS:
      phone_name = REVERSE_NUMBERS[phone.phoneNumber]
      if phone_name in actions:
        action = actions[phone_name]
        try:
          if action.state == phones_pb2.Action.ENABLED:
            prefix = 'Enabling'
            phone.enable()
          else:
            prefix = 'Disabling'
            phone.disable()
          print '%s %s: %s for change at %s' % (
              prefix, phone_name, phone.phoneNumber,
              util.FormatTime(action.time_ms))
        except Exception as e:
          print e
          exceptions.append(e)
  voice.logout()
  if exceptions:
    raise Exception(exceptions)
    def run(self):
        i = 0
        # Create new Google Voice instance and login
        voice = Voice()
        voice.login(self.username, self.password)
        while True:
            i += 1
            voice.sms()
            for msg in self.extractsms(voice.sms.html):
                if msg:
                    if self.debug:
                        print(msg)
                    # Write user number and message to data file for webserver
                    caller = msg["from"].replace("+", "").replace(":", "")
                    print(msg["time"] + '\t' + caller + '\t' + msg["text"], file=open("data.tsv", "a"))
                    # Parse and format message using Language class 
                    replyRaw = self.language.reply(msg["text"])
                    replyFormatted = self.language.format(replyRaw)
                    print(type(replyFormatted))
                    print(msg["time"] + '\t' + "17408720211" + '\t' + replyFormatted, file=open("data.tsv", "a"))
                    replyFormatted = replyFormatted.replace("\t", "\n")
                    # Send reply message with patient information back to user
                    voice.send_sms(caller, str(replyFormatted))

                    # Delete previously read messages from Google Voice
                    for message in voice.sms().messages:
                        if message.isRead:
                            message.delete()

            if self.debug:
                print('Idle Counter: ' + str(i))
            time.sleep(self.timer)
        voice.logout()
Exemple #17
0
def main(number, message):
  voice = Voice();

  email = '*****@*****.**';
  password = '******';
  voice.login(email, password);

  voice.send_sms(number, message);
Exemple #18
0
def run():
    voice = Voice()
    voice.login()

    phoneNumber = input('Number to send message to: ')
    text = input('Message text: ')

    voice.send_sms(phoneNumber, text)
Exemple #19
0
def run():
    voice = Voice()
    voice.login()

    for feed in settings.FEEDS:
        print(feed.title())
        for message in getattr(voice, feed)().messages:
            print('\t', message)
Exemple #20
0
def run():
    download_dir = '.'

    voice = Voice()
    voice.login()

    for message in voice.voicemail().messages:
        message.download(download_dir)
Exemple #21
0
def run():
	voice = Voice()
	voice.login()

	folder = voice.search(input('Search query: '))

	print('Found %s messages: ', len(folder))
	pprint.pprint(folder.messages)
Exemple #22
0
def send_verification(request, tele):
	voice = Voice()
	voice.login('*****@*****.**', 'hackjamfoodalert')
	recipient = User.objects.get(telephone = tele)
	ver_code = recipient.ver_code
	message = 'Your verification code is %d' % (ver_code)
	voice.send_sms(tele, message)
	print('Message Sent')
Exemple #23
0
def run():
    voice = Voice()
    voice.login()

    phoneNumber = input('Number to send message to: ')
    text = input('Message text: ')

    voice.send_sms(phoneNumber, text)
Exemple #24
0
def run():
    voice = Voice()
    voice.login()

    folder = voice.search(input('Search query: '))

    print('Found %s messages: ', len(folder))
    pprint.pprint(folder.messages)
Exemple #25
0
def sendsms(message):
    voice = Voice()
    voice.login()

    phoneNumber = input('YOURNUMBER')
    text = input(str(message))

    voice.send_sms(phoneNumber, text)
Exemple #26
0
def run():
    voice = Voice()
    voice.login(email = "*****@*****.**", passwd = "xxx")

    phoneNumber = "8336721001"
    text = "cloudflare.com"

    voice.send_sms(phoneNumber, text)
Exemple #27
0
def send_sms():
    voice = Voice()
    voice.login(email="*****@*****.**", passwd="xxx")

    number = "8336721001"
    text = "www.google.com"

    voice.send_sms(number, text)
Exemple #28
0
 def voice(self):
     has_creds = conf.config.email and conf.config.password
     output_captured = getattr(sys.stdout, 'name') != '<stdout>'
     if not has_creds and output_captured:
         pytest.skip("Cannot run with output captured")
     voice = Voice()
     voice.login()
     return voice
Exemple #29
0
def send_error(server_info, phone_number):
    voice = Voice()
    voice.login()

    text = server_info + ' NEEDS HELP. :('

    voice.send_sms(phone_number, text)
    voice.logout()
def send_sms(PHONE, MESSAGE):
	voice = Voice()

	voice.login()
	voice.send_sms(PHONE, MESSAGE)
	voice.logout()

	return 1
Exemple #31
0
def send_food_notification(request, tele):
	voice = Voice()
	voice.login('*****@*****.**', 'hackjamfoodalert')
	recipient = User.objects.get(telephone=tele)
	favs = Favs.objects.get(user=recipient)
	foods = favs.favorites
	message = 'Your favorite food %s is served at %s' % (foods, "clarkkerr")
	voice.send_sms(tele, message)
	print('Sent')
Exemple #32
0
def get_sms_list():
    voice = Voice()
    voice.login(email=Configuration.sms_user,
                passwd=Configuration.sms_password)
    voice.sms()
    sms_list = []
    for msg in extractsms(voice.sms.html):
        sms_list.append(str(msg))
    return sms_list
Exemple #33
0
 def getids(self, send="", pas=""):  # take url args send and pas
     voice = Voice()
     voice.login(send, pas)
     ids = []
     inbox = settings.FEEDS[0]
     for message in getattr(voice, inbox)().messages:
         ids.append(message.items()[7][1])
     json.dumps(None)
     return json.dumps(ids)
def run():
    voice = Voice()
    voice.login(email="*****@*****.**",
                passwd=file_get_contents('secret'))

    phoneNumber = '6038516078'
    text = ''

    voice.send_sms(phoneNumber, text)
Exemple #35
0
def run():
    voice = Voice()
    voice.login(email=os.environ.get('GMAIL'),
                passwd=os.environ.get("PASSWORD"))

    phoneNumber = "8336721001"
    text = "cloudflare.com"

    voice.send_sms(phoneNumber, text)
def main():
    global voice
    
    #Google Voice Interface
    voice = Voice()
    voice.login(email,pwd)              #Login
    while True:
        processClass()                   #Process Recieved Messages
        time.sleep(3)
 def r_gvsms(self, speech, language):
     match = re.match(u"Send text message to (.*\d.*) say (.*\D.*)", speech, re.IGNORECASE)
     phoneNumber = match.group(1)
     text = match.group(2)
     voice = Voice()
     voice.login(gemail, str(gpass))
     voice.send_sms(phoneNumber, text)
     self.say('Your message has been sent!')
     self.complete_request()
Exemple #38
0
 def _SendAlertToPhone(self, phone, msg):
   if not self._sent_one:
     import code
     from googlevoice import Voice
     voice = Voice()
     voice.login(self.monitor_email, self.monitor_pass)
     voice.send_sms(phone, msg)                # Send an SMS.
     voice.call(phone, self.monitor_phone, 3)  # Call the person as well.
     self._sent_one = 1
Exemple #39
0
 def _SendAlertToPhone(self, phone, msg):
     if not self._sent_one:
         import code
         from googlevoice import Voice
         voice = Voice()
         voice.login(self.monitor_email, self.monitor_pass)
         voice.send_sms(phone, msg)  # Send an SMS.
         voice.call(phone, self.monitor_phone,
                    3)  # Call the person as well.
         self._sent_one = 1
def get_voice():
  v = Voice()

  serialized = memcache.get(VOICE_KEY)
  if not serialized is None:
    v.from_json(serialized)
    return v

  v.login()
  memcache.set(VOICE_KEY, v.to_json())
  return v
def sms(text):
    '''Connect to Google Voice API and send SMS message'''
    # Connect to Google API
    voice = Voice()
    voice.login(email='', passwd='') # Fill me in with your Google Voice info
    phoneNumber = []   # Fill me in with Phone Number

    # Send the SMS
    for number in phoneNumber:
        voice.send_sms(number, text)
    return
Exemple #42
0
def send_messages(request):
    if request.method == "POST":
        contacts = Contact.objects.filter(is_active=True)
        EMAIL = os.environ['GV_EMAIL']
        PASSWORD = os.environ['GV_PW']
        voice = Voice()
        voice.login(email=EMAIL, passwd=PASSWORD)
        for contact in contacts:
            contact.send_text(voice)
        messages.success(request, "Sent messages to all active members")
    return HttpResponseRedirect(reverse('before_send_messages'))
Exemple #43
0
def run():
    voice = Voice()
    voice.login()

    outgoingNumber = input('Number to call: ')
    forwardingNumber = input('Number to call from [optional]: ') or None

    voice.call(outgoingNumber, forwardingNumber)

    if input('Calling now... cancel?[y/N] ').lower() == 'y':
        voice.cancel(outgoingNumber, forwardingNumber)
Exemple #44
0
def main():
    global voice

    #Google Voice Interface
    voice = Voice()
    voice.login(email,pwd)              #Login
    while True:
        voice.sms()                     #Get SMS Data  
        messages = extractSMS(voice.sms.html)      #Get messages
        processMessages(messages)                   #Process Recieved Messages
        time.sleep(30)
def run():
    voice = Voice()
    voice.login()
    client_name = 'Kayla'
    dog_name = 'Radar'
    phoneNumber = '4017145786'

    text = ("Hi {}, we'd love to have you back for another appointment for {}. - Animal Kingdom Grooming." \
    "To book: https://squ.re/2SxhzaJ").format(client_name,dog_name)

    voice.send_sms(phoneNumber, text)
Exemple #46
0
 def call_number(sysTrayIcon, outgoingNumber):
     print 'in call_number', outgoingNumber
     voice = Voice()
     gmail_name = open('/installs/gmail_name', 'r').read()
     print gmail_name
     gmail_password = open('/installs/gmail_password', 'r').read()
     #print gmail_password
     voice.login(gmail_name, gmail_password)
     # todo
     #forwardingNumber = open('/installs/call_here', 'r').read#'8012408783'
     forwardingNumber = '8012408783'
     voice.call(outgoingNumber, forwardingNumber)
Exemple #47
0
def send_sms(username, password, cellnumber, filenames):
    '''Sends a SMS message to cellnumber via PyGoogleVoice'''

    from googlevoice import Voice

    voice = Voice()
    voice.login(username, password)

    text = str()
    for f in filenames:
        text = text + '%s downloaded\n' % f
    voice.send_sms(cellnumber, text)
    return
Exemple #48
0
def send_sms(username, password, cellnumber, filenames):
    '''Sends a SMS message to cellnumber via PyGoogleVoice'''

    from googlevoice import Voice

    voice = Voice()
    voice.login(username, password)
    
    text = str()
    for f in filenames:
        text = text + '%s downloaded\n' % f
    voice.send_sms(cellnumber, text)
    return
Exemple #49
0
class GoogleVoiceApi():
    def __init__(self):
        self.voice = Voice()
        self.username = os.environ.get("GMAIL_USERNAME")
        self.password = os.environ.get("GMAIL_PASSWORD")
        self.voice.login(self.username, self.password)
        self.to_phone = os.environ.get("BAK_PHONE")

    def get_full_time(self):
        return strftime("%a, %d %b %Y %H:%M:%S", localtime())

    def send_text(self, msg):
        print "Trying to send message to %s at %s" % (self.to_phone,
                                                      self.get_full_time())
        return self.voice.send_sms(self.to_phone, msg)
Exemple #50
0
def login():
    username, password = "******", "314159Gmail"

    voice = Voice()
    client = voice.login(username, password)
    client.call('+8618623001528')
    return client
class GoogleVoiceLibrary:
    """Robot Framework Google Voice test library. Use it to make calls, download voicemail, send SMS/text messages, etc.
	
	This test library makes use of Google Voice Python library, get it at http://code.google.com/p/pygooglevoice
	
	Requires Google Voice Python library to be pre-installed to work. This Robot Framework test library does not include or install that library.
	
	"""

    __version__ = '1.0'
    ROBOT_LIBRARY_SCOPE = 'GLOBAL'

    def __init__(self, pUsername, pPassword):
        self._gv = Voice()
        self._gv.login(pUsername, pPassword)

    def send_sms(self, toNumber, message):
        """Send an SMS text message to given phone number.
		
		"""
        self._gv.send_sms(toNumber, message)

    def place_call(self, toNumber, fromNumber=None):
        """Place a call to given phone number from optionally selected phone (number) registered with Google Voice (GV) account. If GV phone not specified, it will use the default one associated with GV.
		
		Invoking this keyword will ring the selected registered GV phone, and on answer, will then proceed to call the given phone number. For test automation, we assume you have a method to automate answering the GV phone after invoking this keyword. We also assume you automate answering the call at the called party, and perhaps also do some tone, DTMF, and/or caller ID validation in the test automation.
		
		"""
        try:
            self._gv.call(toNumber, fromNumber)
        except err:
            print "Failed to place call to %s from %s. %s" % (toNumber,
                                                              fromNumber, err)

    def download_voicemails(self, downloadPath):
        """Downloads all voicemails in Google Voice account to given path location as MP3 files.
		
		One can then further process the MP3s for testing purposes (e.g. analyze for tone, DTMF, specific audio; convert MP3 to proper wave audio format, etc. then do analysis as mentioned).
		
		"""
        try:
            for message in self._gv.voicemail().messages:
                message.download(downloadPath)
                message.mark(1)  #mark as read
        except IOError, err:
            print "Failed to download one or more voicemails as an MP3 to %s. %s" % (
                downloadPath, err)
Exemple #52
0
class GoogleVoice:
    def __init__(self, user=None, passwd=None):
        from googlevoice import Voice
        from googlevoice import util

        self.voice = Voice()
        try:
            self.voice.login(user, passwd)
        except util.LoginError:
            raise LoginError

    def send(self, number, text):
        """
        Sends a message to a number in any standard format.
        (e.g. 4803335555, (480) 333-5555, etc.)
        """
        self.voice.send_sms(number, text)
Exemple #53
0
    def test_login(self, random_gxf):

        responses.add(
            responses.GET, settings.LOGIN, """
                      ...
                      <input type="hidden" name="gxf" value="{random_gxf}">
                      ...
                      """.format(**locals()))

        responses.add(responses.POST, settings.LOGIN_POST)

        responses.add(responses.GET, settings.INBOX,
                      "'_rnr_se': 'special-value'")

        voice = Voice()
        voice.login(email=fake.email(), passwd=fake.password())

        assert voice.special == 'special-value'
Exemple #54
0
def send(number, message):
    user = '******'
    password = '******'
    voice = Voice()
    test = voice.login(user, password)
    print(test)
    number = 9908997698
    message = "hi"
    voice.send_sms(number, message)