4

I am using the google voice API from here, and trying to send text messages from Python. However, whenever I try to log in using this code, I get something I do not expect:

from googlevoice import tests
from googlevoice import Voice
from googlevoice.util import input

def login():
    username, password = "xyz@gmail.com", "******"
    client = Voice.login(username, password)
    return client

Upon starting this code's parent program (a file that literally just says run this sketch), I get this prompt:

Email Address: 

If I enter an email address, it just freezes. Any help would be greatly appreciated.

I've read a few places that the Google Voice API support is coming to an end/has ended and am wondering if this is why I'm getting an error... If so, are there any free alternatives that are python compatible? I don't want to pay to have to text from my computer!

TobyTobyo
  • 405
  • 2
  • 6
  • 20
  • Take a look at [this answer](http://stackoverflow.com/a/1717181/391161). – merlin2011 Jan 08 '17 at 03:09
  • 1
    You can use twilio, a service wholly dedicated to programatic phone/SMS interaction. They have a python client. – jeffknupp Jan 08 '17 at 03:19
  • @merlin2011 I took a look at the answer, the post its linked too, and links on it but still the same error. I feel like I'm not advanced enough in coding to understand some of the things I'm reading on [here](https://code.google.com/archive/p/pygooglevoice/issues/6). – TobyTobyo Jan 08 '17 at 03:53
  • @jknupp I'm a bit adverse to using twilio, since it has a paid-for version. I'd like to shy away from it, because my unpaid messages would always have a "Sent using twilio" at the start of it. But I guess I might have too. :( – TobyTobyo Jan 08 '17 at 03:54

1 Answers1

4

Somehow, this has made it work now:

from googlevoice import Voice
from googlevoice.util import input
import sys
import BeautifulSoup
import fileinput

import Listen #A voice recognition script I wrote

def login():
    username, password = "xyz@gmail.com", "******"

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

The only thing different that I've done is changed some of the libraries I've imported, but I can finally get past that "Email Address: " error, and run the rest of my code. have yet to try and test it my sending a text yet though!

@Merlin2011 and @jknupp17, thank you so much for your suggestions!

TobyTobyo
  • 405
  • 2
  • 6
  • 20