谷歌刚刚更新了他们的谷歌语音平台。这似乎与我的googlevoice登录停止工作直接相关。
我尝试过以下几种方法:
这里建议的允许验证码的谷歌语音帐户在这里有一个2.7版本的解决方案,但没有成功退出我的会话,那就是voice.logout()
在谷歌语音网站改头换面之前,这段代码一直运行得很好。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
发布于 2017-02-21 05:34:08
我也有同样的问题。看起来发回的页面与之前发送的页面截然不同,是javascript/ajax解决方案。
我对它进行了一些修改,并跟踪到之前包含的丢失的“特殊”会话标记。PyGoogleVoice正在从谷歌发回的页面中搜索字符串文字"_rnr_se“,以抓取会话值。找不到该字符串,这会导致它认为登录失败。据我所知,PGV需要该令牌来进行url/函数回调,以模拟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值的新方法,它可能就不会太远了。
目前我的时间有点少,但我希望能让它再次工作起来。通过javascript在浏览器中查看会话是如何启动的,并让PGV模拟新的URL,等等,这可能就是在处理firebug等问题。
发布于 2017-04-28 11:44:45
每一位沃德·芒迪:
新版本的gvoice命令行sms文本信息可用,这是固定与谷歌的新的现代化的"AngularJS“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://stackoverflow.com/questions/42097689
复制相似问题