Python Google Voice

2020-02-26 12:41发布

问题:

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!

回答1:

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!