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
Beispiel #2
0
def run():
    voice = Voice()
    voice.login()

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

    print('Found %s messages: ', len(folder))
    pprint.pprint(folder.messages)
Beispiel #3
0
def run():
	voice = Voice()
	voice.login()

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

	print('Found %s messages: ', len(folder))
	pprint.pprint(folder.messages)
Beispiel #4
0
elif command == "Placed" :
	folder = voice.placed().messages
	foundmsg = [ msg for msg in folder]
elif command == "Received" :
	voice.received()
	folder = voice.received.messages
	foundmsg = [ msg for msg in folder]
elif command == "Missed" :	
	folder = voice.missed().messages
	foundmsg = [ msg for msg in folder]
#elif command == "History" :
	#try:
		#phone = argv[4]
		#folder = voice.search(phone)
		#foundmsg = [ msg for msg in folder.messages if (msg.messageText != "") ]
	#except:
		#print ('Error! Please provide a phone number. ')
		#voice.logout()
		#exit(0)
else:
	folder = voice.search(command)
	foundmsg = [ msg for msg in folder.messages]

if foundmsg != []:
	foundmsg.sort(key=lambda x:x['displayStartDateTime'], reverse=True)
	print json.dumps(foundmsg, indent=4, default=str)
else:
	print('Nothing found! ')
 
voice.logout()
Beispiel #5
0
from googlevoice import Voice, util

voice = Voice()
voice.login()
searchterm = util.input('Search query: ')

# print all pages of results, oldest to newest
page = 1
folder = voice.search(searchterm)
util.print_('Found %s messages: ' % len(folder))
while len(folder.messages) > 0:
    for msg in sorted(folder.messages, key=lambda m: m.startTime,
                      reverse=True):
        util.print_('%s %s' % (msg.displayStartDateTime, msg.phoneNumber))
    page += 1
    folder = voice.search(searchterm, page)
Beispiel #6
0
from googlevoice import Voice,util


voice = Voice()
voice.login()

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

util.print_('Found %s messages: ', len(folder))
util.pprint(folder.messages)
Beispiel #7
0
from googlevoice import Voice, util

voice = Voice()
voice.login('*****@*****.**', 'Crown87InfernalPigeon')

number = '+16056514032'
folder = voice.search(util.input()='+16056514032')

util.print_('Found %s messages: ', len(folder))
util.pprint(folder.messages)
Beispiel #8
0
            msgitem = {"id" : conversation["id"]}		# tag this message with conversation ID
            spans = row.findAll("span",attrs={"class" : True}, recursive=False)
            for span in spans :							# for all spans in row
                cl = span["class"].replace('gc-message-sms-', '')
                msgitem[cl] = (" ".join(span.findAll(text=True))).strip()	# put text in dict
            msgitems.append(msgitem)					# add msg dictionary to list
    return msgitems
    
voice = Voice()
voice.login()

try:

    convos = {}

    html, messageData = voice.search('from:x -in:Trash')

    while (messageData.totalSize != 0):    
        messages = extractsms(html)

        for msg in messageData.messages:
            convos[msg.id] = Convo(msg)
            
        for msg in messages:
            convos[msg['id']].addText(Txt(msg['from'],msg['time'], msg['text']))
            
        for msg in messageData.messages:
            msg.delete()
            
        html, messageData = voice.search('from:x -in:Trash')
    
Beispiel #9
0
    folder = voice.spam().folder
    foundmsg = [msg for msg in folder.messages]
elif command == "Trash":
    folder = voice.trash().folder
    foundmsg = [msg for msg in folder.messages]
elif command == "Placed":
    folder = voice.placed().messages
    foundmsg = [msg for msg in folder]
elif command == "Received":
    folder = voice.received().messages
    foundmsg = [msg for msg in folder]
elif command == "Missed":
    folder = voice.missed().messages
    foundmsg = [msg for msg in folder]
elif command == "Phone":
    folder = voice.search(ID).messages
    foundmsg = [dict(msg) for msg in folder if (msg.messageText != "")]
    getID = [msg.id for msg in folder if (msg.messageText != "")]
    ID = ''.join(getID)
    foundmsg = folder

try:
    for message in foundmsg:
        if message.id == ID:
            message.mark()
            print json.dumps(message, indent=4, default=str)
            break
except:
    print('Error! With Message ID. ')

voice.logout()