python 的 gdata 电子表格库不再工作了?

gdata spreadsheet library for python not working anymore?

我试图 运行 在我的一个 google 文档中查询数据,它已经工作了几个月。从昨天或前一天开始,我发现我的脚本不再有效。 Google 是否更新了电子表格的 api?有人找到解决方法了吗?

我的错误是这样的:

Traceback (most recent call last):
  File "build_packer_image.py", line 311, in <module>
    for index, entry in enumerate(client.GetWorksheetsFeed(doc_key).entry):
  File "/build/toolchain/mac-10.5-32/lib/python2.7/site-packages/gdata/spreadsheet/service.py", line 129, in GetWorksheetsFeed
    converter=gdata.spreadsheet.SpreadsheetsWorksheetsFeedFromString)
  File "/build/toolchain/mac-10.5-32/lib/python2.7/site-packages/gdata/service.py", line 1074, in Get
    return converter(result_body)
  File "/build/toolchain/mac-10.5-32/lib/python2.7/site-packages/gdata/spreadsheet/__init__.py", line 411, in SpreadsheetsWorksheetsFeedFromString
    xml_string)
  File "/build/toolchain/mac-10.5-32/lib/python2.7/site-packages/atom/__init__.py", line 93, in optional_warn_function
    return f(*args, **kwargs)
  File "/build/toolchain/mac-10.5-32/lib/python2.7/site-packages/atom/__init__.py", line 127, in CreateClassFromXMLString
    tree = ElementTree.fromstring(xml_string.replace('doctype','DOCTYPE'))
  File "<string>", line 125, in XML
cElementTree.ParseError: no element found: line 1, column 0
Build step 'Execute shell' marked build as failure
Finished: FAILURE

我正在使用:

我只是在我的代码中使用文档密钥而不是 oauth,如果这有什么不同(我将用户名和密码传递给 ClientLogin 方法)

实际上这里是问题的答案:

The use of client login (using username/password instead of oauth2) is likely the cause of the error. That protocol was deprecated 3+ years ago and was just shutdown. If you capture the HTTP response (which appears to have some HTML content), that might confirm if it is related to the shutdown. Migrating to OAuth 2 would get your apps working again.

发送 xml 以更新电子表格后 google 使用登录页面进行响应。 这意味着身份验证现在不适用于 gdata

https://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=3851#c2