def run_test(user, passwd, call_number): voice = pygvoicelib.GoogleVoice(user, passwd) try: phone_list = voice.get_numbers() except pygvoicelib.LoginError as e: print('Failed to login. Reason: %s' % (e.reason)) print('Reasons Legend:') print(' failed -> Invalid credentails') print(' captcha -> Account is captcha locked') print(' error -> Unknown/Other errors') return from_num = '' for num in phone_list: if num.isdigit() and phone_list[num]['verified']: from_num = num print('Login successful.') if not from_num: print( 'Unable to find a validated phone to test a call with. Aborting the test ...' ) return print('Using this verified PSTN number of the test -> %s' % (from_num)) print('Testing a simple call. Result -> ' + repr(voice.call('+' + call_number, '+' + from_num))) print('Sleeping 30 seconds ...') time.sleep(30) print('Testing a cancel. Result -> ' + repr(voice.cancel())) print('Note: Results returned by google might not be that reliable') print() print('Here is the state that can be saved in DB or somewhere else: ' + repr(voice.get_state())) print() print('Now we will save the state and load it from scratch to test') state = voice.get_state() voice = pygvoicelib.GoogleVoice(*state) try: phone_list = voice.get_numbers() except pygvoicelib.LoginError as e: print('Failed to login. Reason: %s' % (e.reason)) return except pygvoicelib.ServerError as e: print('Google server error. Reason: %s' % (e.reason)) return print('Test all successful. We are AWESOME!')
def run_test(user, passwd, call_number): voice = pygvoicelib.GoogleVoice(user, passwd) try: phone_list = voice.get_numbers() except pygvoicelib.LoginError, e: print 'Failed to login. Reason: %s' % (e.reason) print 'Reasons Legend:' print ' failed -> Invalid credentails' print ' captcha -> Account is captcha locked' print ' error -> Unknown/Other errors' return
save_loc = None def handle_captcha(voice): voice.passwd = passwd print 'Captcha URL is: %s\n' % (voice.captcha_url) print 'Enter captcha value: ' voice.captcha_entry = input() def handle_save_token(voice): global save_loc print 'Saving Credentials ...' save_loc = voice.get_state() def run_test(uesr, passwd) voice = pygvoicelib.GoogleVoice(user, passwd) voice.handle_captcha_entry = handle_captcha voice.handle_save_token = handle_save_token try: ret = voice.get_numbers() ret2 = voice.cancel() print 'Test 1 OK - We succeeded to login' except pygvoicelib.LoginError, e: if e.reason == 'failed': print 'Test 1 FAILED - We failed to login (Wrong passwod)' elif e.reason == 'captcha': print 'Test 1 FAILED - We failed to login (Captcha locked)' else: print 'Test 1 FAILED - Unknown Error' except:
import sys import pygvoicelib try: input = raw_input except NameError: input = input def handle_captcha(voice): voice.passwd = passwd print 'Captcha URL is: %s\n' % (voice.captcha_url) print 'Enter captcha value: ' voice.captcha_entry = input() def run_test(user, passwd) print 'We will try random wrong passwords to get a captcha lock ...' voice = pygvoicelib.GoogleVoice(user, passwd) voice.handle_captcha_entry = handle_captcha for i in range(50): print 'Wrong password - try %d' % (i) voice.passwd = str(i+111111) try: voice.validate_credentials() except pygvoicelib.LoginError, e: if e.reason != 'failed': raise if voice.auth_token: break try: ret = voice.get_numbers()
#!/usr/bin/python import pygvoicelib username = raw_input('username:'******'application password:') client = pygvoicelib.GoogleVoice(username, apppass) client.validate_credentials() print """ import pygvoicelib username="******" apppass="******" auth_token="{2}" rnr_se="{3}" client = pygvoicelib.GoogleVoice(username,apppass,auth_token,rnr_se) #replace number with phone number below #client.sms(number,"test") """.format(username, apppass, client.auth_token, client.rnr_se)
cd /home/pi export GIT_SSL_NO_VERIFY=1 git clone https://github.com/korylprince/pygvoicelib.git python get_auth.py vi text.py !/usr/bin/python import pygvoicelib number = raw_input(‘number:’) txtmsg = raw_input(‘message:’) client = pygvoicelib.GoogleVoice(username,apppass,auth_token,rnr_se) client.sms(number,txtmsg) !/usr/bin/python import pygvoicelib client = pygvoicelib.GoogleVoice(‘[email protected]’,'asdfahrwsthjtrh’,’4k3EozF_Qmrg3tD2_m56nQtFHCVSaTdUxb7HvcaN6g3PV929VH0eH4GGVOVpbVK2O6EaGFzMDYA6PhPjaEHr0ZGjO1GQN3RGhQLXqePWfglbXnA2n7XpUophOk5qztQyv2fYM7eYgtVCYeO6txTqbDQAAANsAAABZ7d0GTL2pJsUauPkH4Z3cpbJFqjfLZYfhok1b11pIMDnEOypZgIcOVdPEt8jEMx7oY9hHJeJoDQZYndDJDu8uoDbDWgxl87GMy990snKWR8iy8VIB17769eVWboa3224U8DLZLUWMpP0d4hfsDK5MQ’,'L6tph126BjmNjDcfTZGaWYeb+sk=’) python text.py
#!/usr/bin/python import serial import pygvoicelib ser = serial.Serial('/dev/ttyACM0', 9600) client = pygvoicelib.GoogleVoice('*****@*****.**','rkswxivkhjjidmfv','DQAAAP4AAAA1MFOT2vIVytOXaD0QvodOCMcjc2GFtfS7CJsneNTvJF0ByETkNDSaqdy2_7dc7u5hLSvahDU7KNjyFCOAK7_K8LuUS-QbANR4mghR-oZJWzbyd0Whigv38IwPz5Veb9_ryMDfEG3EuJC2r5C0pB_1it_EHDKiKnm2mcSkk7NWLjV6Q3r0nn19Uzh7hsR0srXNQZ3kJIasazqiVmp-jWbpVJx1zyqfJ-TkZvGFFuuvbpeCsHj8qNxlypIn_gTw5_IadkNEIXRhunLEEDPurHtRd5o8G7PKZws8IZP3N03HXUvAeNbQ7NIN4d8nK3EstxUYLljr4ShbZyvG6BvH9O6j','uVtFA9MrINl47hYMMo6KKfYn648=') reading = "" number = raw_input('Please enter the number you wish\n\tto send notifications to: ') max_sitting_time = raw_input('Please enter the amount of time you wish\n\tto elapse before notification is sent: ') max_sitting_timeI = int(max_sitting_time) message1 = "You have been sitting for " + max_sitting_time + " seonds." message2 = "You have been sitting for " + max_sitting_time + " more seconds." counterA = 0 counterB = 0 print("\n\nRunning...") print("To exit press 'CTL-C'") while 1 : reading = ser.readline() readingI = int(reading) if (readingI > 400): counterA = counterA + 1 counterB = counterB + 1 else:
print 'Unable to find a validated phone to test a call with. Aborting the test ...' return print 'Using this verified PSTN number of the test -> %s' % (from_num) print 'Testing a simple call. Result -> ' + repr( voice.call('+' + call_number, '+' + from_num)) print 'Sleeping 30 seconds ...' time.sleep(30) print 'Testing a cancel. Result -> ' + repr(voice.cancel()) print 'Note: Results returned by google might not be that reliable' print print 'Here is the state that can be saved in DB or somewhere else: ' + repr( voice.get_state()) print print 'Now we will save the state and load it from scratch to test' state = voice.get_state() voice = pygvoicelib.GoogleVoice(*state) try: phone_list = voice.get_numbers() except pygvoicelib.LoginError, e: print 'Failed to login. Reason: %s' % (e.reason) return except pygvoicelib.ServerError, e: print 'Google server error. Reason: %s' % (e.reason) return print 'Test all successful. We are AWESOME!' if __name__ == '__main__': print 'Please enter your Google Username:'******'Please enter your Password:',