截至几天前,我能够访问我的 Google 电子表格 来自应用程序(在应用程序引擎中),但今天它被破坏了。
也就是说,我可以
name= "name of my spreadsheet"
self.client = gdata.spreadsheet.text_db.DatabaseClient()
self.client.GetDatabases(name=name)
并且成功了。事实上,当我运行时,这仍然有效 dev_应用程序服务器
但是,如果在应用程序引擎上崩溃。它说它无法解析 XML。
我在gdata代码中添加了一些打印,发现它不能 解析它,因为它认为的 XML 实际上只是以下的 HTML 登录页面。
现在发生的事情是 python gdata 库做了一个 (“eleanor”是电子表格名称)
GET /feeds/documents/private/full?title=eleanor
然后回来
<HTML>
<HEAD>
<TITLE>Moved Temporarily</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Moved Temporarily</H1>
The document has moved <A HREF="https://www.google.com/accounts/
ServiceLogin?
service=writely&passive=true&nui=1&continue=http%3A%2F
%2Fdocs.google.com%2Ffeeds%2Fdocuments%2Fprivate%2Ffull%3Ftitle
%3Deleanor&followup=http%3A%2F%2Fdocs.google.com%2Ffeeds
%2Fdocuments%2Fprivate%2Ffull%3Ftitle%3Deleanor">here</A>.
</BODY>
</HTML>
但是,当在 dev_appserver.py 上本地运行时,相同的 GET 返回正确的 XML:
<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/
2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'
xmlns:docs='http://schemas.google.com/docs/2007' xmlns:batch='http://
schemas.google.com/gdata/batch' xmlns:gd='http://schemas.google.com/g/
2005'><id>http://docs.google.com/feeds/documents/private/full</
id><updated>2009-10-29T19:14:07.401Z</updated><category scheme=......
我仔细检查了,是的,我的应用程序被授权访问谷歌 文档。
那么,“暂时移动”是怎么回事?这是 googleplex 的暂时性问题,还是身份验证问题?
最佳答案
Docs 正在将您重定向到登录页面。在尝试获取电子表格之前,您需要进行身份验证。不过,我不确定为什么它不要求您在开发服务器上进行身份验证。
关于python - 无法从应用程序引擎访问 Google 电子表格 : "Moved Temporarily"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1646073/