python - pygooglevoice登录问题

我正在进行一个实验,在该实验中,我通过电子邮件向大量主题发送/发送标准消息,然后通过电子邮件/文本接收他们的回复。要添加短信功能,我想使用pygooglevoice。使用空闲界面时,我可以正常登录。但是,当我运行示例脚本时,它会引发“登录错误”。我已经实现了此处列出的修复程序(替换了pygooglevoice访问URL):Pygooglevoice login error

我正在运行的示例脚本:

from googlevoice import Voice  
import sys  
import BeautifulSoup  



 def extractsms(htmlsms) :
     """
     extractsms  --  extract SMS messages from BeautifulSoup tree of Google Voice SMS HTML.

     Output is a list of dictionaries, one per message.
     """
     msgitems = []  # accum message items here
     #  Extract all conversations by searching for a DIV with an ID at top level.
     tree = BeautifulSoup.BeautifulSoup(htmlsms)  # parse HTML into tree
     conversations = tree.findAll("div",attrs={"id" : True},recursive=False)
     for conversation in conversations :
         #  For each conversation, extract each row, which is one SMS message.
         rows = conversation.findAll(attrs={"class" : "gc-message-sms-row"})
         for row in rows :  # for all rows
             #  For each row, which is one message, extract all the fields.
             msgitem = {"id" : conversation["id"]}  # tag this message with conversation ID
             spans = row.findAll("span",attrs={"class" : True}, recursive=False)
             for span in spans :  # for all spans in row
                 cl = span["class"].replace('gc-message-sms-', '')
                 msgitem[cl] = (" ".join(span.findAll(text=True))).strip()  # put text in dict
             msgitems.append(msgitem)  # add msg dictionary to list
     return msgitems

 voice = Voice() 
 voice.login('MY_GV_USERNAME','MY_GV_PASSWORD')

 voice.sms() for msg in extractsms(voice.sms.html):
 print str(msg)


错误:

> File "build\bdist.win32\egg\googlevoice\voice.py", line 78, in login
>     raise LoginError LoginError


另外,如果有人为逐步卸载Windows的pygooglevoice提供分步建议(以确保我能获得所有文件),我将不胜感激。

最佳答案

我做了一个克隆,该克隆当前有效(至少用于发送SMS消息):http://code.google.com/r/kkleidal-pygooglevoiceupdate/

问题是Google更改了登录URL。另外,我在POST请求中添加了一些参数,这可能有助于解决POST请求遇到的一些问题。现在登录应该可以正常工作。

本文翻译自 https://stackoverflow.com/questions/17354166/

网站遵循 CC BY-SA 4.0 协议,转载或引用请注明出处。

标签 python google-voice


相关文章:

python - 解释numpy.where结果

python - Django静态设置

python - pip安装:在没有sudo的情况下升级/ usr中的库

python - Python Google语音

python - Matplotlib,从三个不等长度的数组创建堆积直方图

python - 如何遍历对象并将其所有属性分配给列表

android - 如何从Google语音助手访问我的Android应用程序

android - 远程检测Android手机的连接状态

android - 找不到处理Intent的活动{act = android.speech.action.RECOGNIZE_SPEECH(有附加内容)}