Pygoogle语音未登录

时间:2017-02-07 18:53:48

标签: python python-3.x login google-voice

谷歌刚刚更新了谷歌语音平台。这似乎与我的googlevoice登录停止工作时直接相关。

我尝试了以下内容:

  • 允许此处建议的验证码(pygooglevoice-login-error
  • 在此处调整2.7解决方案,没有运气Python Google Voice
  • 退出我的会话,即voice.logout()
  • 卸载了pygooglevoice并重新安装。
  • 尝试了不同的Google语音帐户。

此代码完美运行,直到谷歌语音网站改造。 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()

错误日志:

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

2 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。看起来发回的页面是一个彻底不同的,javascript / ajax解决方案,而不是以前发送的。

我一直在搞乱它并追踪到之前包含的“特殊”会话令牌。 PyGoogleVoice正在搜索从谷歌发回的HTML页面中的字符串文字“_rnr_se”来刮取会话值。找不到该字符串,这会导致它认为登录失败。据我所知,PGV需要该令牌才能使url / function回调模仿Web客户端。

现在有一个javascript函数正在检索该变量,而不是将其传回,而是在HTML页面中进行硬编码。

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_);
};  

然后在拨打电话时,它正在使用这样的值:

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());
};

我想我会分享我的发现,以便其他人可以帮助修补新代码,并弄清楚如何检索和与这个新版本交互。一旦我们找到捕获xsrfToken或_rnr_se值的新方法,它可能不会太遥远。

目前我的时间有点短暂,但我很想再次开始工作。这可能是因为搞乱使用firebug等来观察会话如何通过javascript在浏览器中启动并让PGV模仿新的URL等。

答案 1 :(得分:0)

Per Ward Mundy:

新版本的gvoice命令行短信短信可用,修复后可与Google的新现代化&#34; AngularJS&#34; gvoice网页界面。如果有人想知道,这是一个很小的改变,让它工作。 将这些命令粘贴到shell中进行升级:

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