Pygoogle voice not logging In

孤街浪徒 提交于 2021-02-08 09:33:31

问题


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

回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/42097689/pygoogle-voice-not-logging-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!