2

Google just updated their google voice platform. Which seems to directly correlate when my googlevoice login stopped working.

I have tried the following:

  • allowing captcha as suggested here (pygooglevoice-login-error)
  • Adapting a 2.7 solution here with no luck Python Google Voice
  • Logging out of my session that is voice.logout()
  • Uninstalled pygooglevoice and reinstalled.
  • Tried a different google voice account.

This code was working perfectly up until the google voice website makeover. python 3.5.2 windows Server2012R2

from googlevoice import Voice
from googlevoice.util import input


voice = Voice()
voice.login(email='email@gmail.com', passwd='mypassword')


def sendText(phoneNumber,text):
    try:
        voice.send_sms(phoneNumber, text)
    except Exception:
        pass

sendText(phoneNumber=[aaabbbcccc],text="Hello from Google Voice!")

voice.logout()

Error Log:

Traceback (most recent call last):
  File voice.py, line 95, in login
    assert self.special
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  line 7, in <module>
    voice.login(email='********', passwd='*******')
  File voice.py, line 97, in login
    raise LoginError
googlevoice.util.LoginError
Community
  • 1
  • 1
Blake
  • 21
  • 1
  • 5
  • I have no solution, but I can confirm Blakes findings on Debian Jessie with python 2.7 and raspian wheezy with python 2.7. – joebob Feb 14 '17 at 17:02
  • I've also noticed that the new version has a different url than the 'legacy' version - https://voice.google.com/u/0/ rather than https://www.google.com/voice/b/0. Replacing the old urls' with their modern equivalents still gives me an error, but I'm quite sure this would need to be done as well. Unfortunately, there has been no support or feedback from Google when I've emailed them and submitted a "feedback" form. – TobyTobyo Feb 23 '17 at 21:21

2 Answers2

0

I've got the same issue. It looks like the page being sent back is a drastically different, javascript/ajax solution than what was sent before.

I've been messing with it a bit and tracked it to the missing the "special" session token that was included before. PyGoogleVoice is searching for the string literal "_rnr_se" within the page HTML sent back from google to scrape the session value. That string is not found, which causes it to think the login failed. From what I can tell, PGV needs that token to make the url/function calls back to imitate the web client.

There's a javascript function that's retrieving that variable now, instead of it being passed back, hardcoded in the HTML page.

gc.net.XhrManager = function(xsrfToken, notification, loadNotification) {
  goog.events.EventTarget.call(this);
  this.xsrfToken_ = xsrfToken;
  this.notification_ = notification;
  this.loadNotification_ = loadNotification;
  this.logger_ = goog.debug.Logger.getLogger("gc.Xhr");
  this.xhrManager_ = new goog.net.XhrManager(0);
  this.activeRequests_ = new goog.structs.Map;
  this.eventHandler_ = new goog.events.EventHandler(this);
  this.eventHandler_.listen(this.xhrManager_, goog.net.EventType.SUCCESS, this.onRequestSuccess_);
  this.eventHandler_.listen(this.xhrManager_, goog.net.EventType.ERROR, this.onRequestError_);
};  

And then when making calls, it's using the value like so:

gc.net.XhrManager.prototype.sendPost = function(id, url, queryData, opt_successCallback, opt_errorCallback) {
  this.sendAnalyticsEvent_(url, queryData);
  id = goog.string.buildString(id, this.idGenerator_.getNextUniqueId());
  if (goog.isDefAndNotNull(queryData) && !(queryData instanceof goog.Uri.QueryData)) {
    throw Error("queryData parameter must be of type goog.Uri.QueryData");
  }
  var uri = new goog.Uri(url), completeQueryData = queryData || new goog.Uri.QueryData;
  completeQueryData.set("_rnr_se", this.xsrfToken_);
  this.activeRequests_.set(id, {queryData:completeQueryData, onSuccess:opt_successCallback, onError:opt_errorCallback});
  this.xhrManager_.send(id, uri.toString(), "POST", completeQueryData.toString());
};

I figured I'd share my findings so others can help tinker with the new code and figure out how to retrieve and interact with this new version. It may not be too far off, once we can find the new way to capture that xsrfToken or _rnr_se value.

I'm a bit short on time at the current moment, but would love to get this working again. It's probably a matter of messing with firebug, etc. to watch how the session gets started in browser via javascript and have PGV mimic the new URLs, etc.

NumericOverflow
  • 899
  • 8
  • 17
  • 2
    FYI - I've been playing with this a bit just to gauge how much rework is required to interface with the new GV design, and it's a fairly substantial change. I've managed to kludge my version of PGV to send a text message (which is all I use it for) but it's not very clean - just a proof-of-concept modification. – NumericOverflow Feb 23 '17 at 13:45
  • It actually seems like the special sauce required to make API calls is no longer the "_rnr_se" token but now the "gvx" token that gets passed as a cookie during sign-in. I haven't quite figured out which page will consistently create that gvx cookie for me - it seems like I can capture it when I sign in using 2-factor, but not always when I do a password-only signin. Tracking down how to reliably snag this cookie so we can initialize the GVoice API will be required to get the new version working with pygooglevoice. – NumericOverflow Feb 23 '17 at 13:45
  • Would you mind sharing your proof-of-concept mods with some comments so we can follow along and try to work with you on it? – TobyTobyo Feb 23 '17 at 21:24
  • 2
    @TobyTobyo - I don't want to drop a direct link that will be locked on this thread indefinitely, but I created a fork on github (under my same username) and have uploaded my work-in-progress to a dev branch in my repo. I'd hope eventual changes get merged back upstream to pettazz's eventually, which would make my direct link just more confusing in the future for anyone who stumbles onto this thread. https://github.com/pettazz/pygooglevoice/network – NumericOverflow Feb 25 '17 at 20:11
  • Solid digging... That's some good work. Looking to see how much further I can develop the proof of concept code. Noticed it's not checked in to your fork yet? – Bennett Elder Feb 26 '17 at 09:29
0

Per Ward Mundy:

New version of gvoice command line sms text messaging is available, which is fixed to work with Google's new modernized "AngularJS" gvoice web interface. It was a small change to get it working, in case anyone is wondering. Paste these commands into your shell to upgrade:

cd ~

git clone https://github.com/pettazz/pygooglevoice

cd pygooglevoice

python setup.py install

cp -p bin/gvoice /usr/bin/.

pip install --upgrade BeautifulSoup

https://pbxinaflash.com/community/threads/sms-with-google-voice-is-back-again.19717/page-2#post-129617

javaDeveloper
  • 1,403
  • 3
  • 28
  • 42
Dave
  • 1