pygooglevoice登录问题

时间:2013-06-27 22:17:24

标签: python google-voice

我正在进行一项实验,我正在通过电子邮件发送/发送一大组主题标准消息,然后通过电子邮件/文本接收他们的回复。要添加短信功能,我想使用pygooglevoice。当我使用Idle接口时,我能够正常登录。但是当我运行一个示例脚本时,它会抛出“登录错误”。我已经实现了此处列出的修补程序(替换了网址pygooglevoice访问权限):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

或者,如果某人有逐步建议干净地卸载pythonvoice for windows(以确保我获得所有文件),我真的很感激。

1 个答案:

答案 0 :(得分:1)

我制作了一个目前有效的克隆版(至少用于发送短信):http://code.google.com/r/kkleidal-pygooglevoiceupdate/

问题在于Google更改了登录网址。另外,我在POST请求中添加了一些参数,这可能有助于解决POST请求遇到的一些问题。登录现在应该顺利进行。