Пример #1
0
def run():
    download_dir = '.'

    voice = Voice()
    voice.login()

    for message in voice.voicemail().messages:
        message.download(download_dir)
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)
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)
Пример #4
0
	ID = json.loads(argv[5])
except:
	print ('Error! Please provide a Message ID. ')
	voice.logout()
	exit(0)

counter = 0
try:
	if msgfolder == "Inbox" :
		msglen = len(voice.inbox().messages)
		for message in voice.inbox().messages:
			counter = doactions(counter, ACTION, message.id , ID)
			if (msglen == counter) :
				break
	elif msgfolder == "Voicemail" :
		msglen = len(voice.voicemail().messages)
		for message in voice.voicemail().messages:
			counter = doactions(counter, ACTION, message.id , ID)
			if (msglen == counter) :
				break
	elif msgfolder == "Recorded" :
		msglen = len(voice.recorded().messages)
		for message in voice.recorded().messages: 
			counter = doactions(counter, ACTION, message.id , ID)
			if (msglen == counter) :
				break
	elif msgfolder == "Messages" :
		msglen = len(voice.sms().messages)
		for message in voice.sms().messages:
			counter = doactions(counter, ACTION, message.id , ID)
			if (msglen == counter) :
Пример #5
0
except:
    print('Error! Please provide Email Account.')
    exit(0)

try:
    password = argv[2]
except:
    print('Error! Please provide Passsword.')
    exit(0)

try:
    voice.login(email, password)
except:
    print('Error! Login failed.')
    exit(0)

try:
    for message in voice.voicemail().messages:
        directory = "googlevoicemail/" + message.id
        if not path.isdir(directory):
            makedirs(directory)
            message.download(directory)
    folder = voice.voicemail().messages
    foundmsg = [msg for msg in folder]
    if foundmsg != []:
        foundmsg.sort(key=lambda x: x['displayStartDateTime'], reverse=True)
        print json.dumps(foundmsg, indent=4, default=str)
except:
    print("Error! Voicemails not downloaded.")

voice.logout
Пример #6
0
from googlevoice import Voice

download_dir = '.'

voice = Voice()
voice.login()

for message in voice.voicemail().messages:
    message.download(download_dir)
Пример #7
0
		HTMLcom = re.compile('<!--.*?-->') # Matches HTML comments
      		extractedText = HTMLtag.sub('', HTMLcom.sub('', str(extractedText)))
      		extractedSMSNumber = HTMLtag.sub('', HTMLcom.sub('', str(extractedSMSNumber)))
		extractedSMSNumber=extractedSMSNumber.strip();
		extractedSMSNumber=extractedSMSNumber.replace(":","");
		extractedSMSNumber=extractedSMSNumber.replace("(","");
		extractedSMSNumber=extractedSMSNumber.replace(")","");
		extractedSMSNumber=extractedSMSNumber.replace("-","");
		extractedSMSNumber=extractedSMSNumber.replace(" ","");
	#	print  extractedText
	#	print  extractedSMSNumber
		message_text=extractedText
		number=extractedSMSNumber
		smsRequest=True

	if len(voice.voicemail().messages) > 0 and smsRequest==False:
		newMessage=True
		voiceRequest=True
		print "wa wa wee wa!  We got a message!"
       	#Take a peek into the voicemail folder
		voice_parse=BeautifulSoup(voice.voicemail_html())		
#              	print(voice.voicemail_html())
       	#Search for voicemail messages
		voice_content=voice_parse.find(attrs={"class":"gc-message-message-display"})
		extractednumber=voice_parse.find(attrs={"class":"gc-message-mni"})
       	# Strip out the HTML 
		HTMLtag = re.compile('<.*?>')      # Matches HTML tags
		HTMLcom = re.compile('<!--.*?-->') # Matches HTML comments
		voice_clean = HTMLtag.sub('', HTMLcom.sub('', str(voice_content)))
		print extractednumber
		if extractednumber is not None:
Пример #8
0
	print ('Error! Please provide a FOLDER. ')
	voice.logout()
	exit(0)
	
try:
	ID = argv[4]
except:
	print ('Error! Please provide a Message ID. ')
	voice.logout()
	exit(0)

if command == "Inbox" :
	voice.inbox()
	allmessages = extractdata(voice.inbox.html)
elif command == "Voicemail" :
	voice.voicemail()
	allmessages = extractdata(voice.voicemail.html)
elif command == "Recorded" :
	voice.recorded()
	allmessages = extractdata(voice.recorded.html)
elif command == "Messages" :
	voice.sms()
	allmessages = extractdata(voice.sms.html)
elif command == "All" :
	voice.all()
	allmessages = extractdata(voice.all.html)
elif command == "Spam" :
	voice.spam()
	allmessages = extractdata(voice.spam.html)
elif command == "Trash" :
	voice.trash()
Пример #9
0
def run():
    voice = Voice()
    voice.login()

    for message in voice.voicemail().messages:
        print(message)
Пример #10
0
    print('Error! Please provide a COMMAND. ')
    voice.logout()
    exit(0)

try:
    ID = argv[4]
except:
    print('Error! Please provide a Message ID or Phone Number. ')
    voice.logout()
    exit(0)

if command == "Inbox":
    folder = voice.inbox().messages
    foundmsg = [msg for msg in folder]
elif command == "Voicemail":
    folder = voice.voicemail().messages
    foundmsg = [msg for msg in folder]
elif command == "Recorded":
    folder = voice.recorded().messages
    foundmsg = [msg for msg in folder]
elif command == "Messages":
    folder = voice.sms().messages
    foundmsg = [msg for msg in folder]
elif command == "All":
    folder = voice.all().messages
    foundmsg = [msg for msg in folder]
elif command == "Spam":
    folder = voice.spam().folder
    foundmsg = [msg for msg in folder.messages]
elif command == "Trash":
    folder = voice.trash().folder