【问题标题】:401 and 403 Errors with google base API谷歌基础 API 的 401 和 403 错误
【发布时间】:2011-03-09 05:51:49
【问题描述】:

我使用 Google App 引擎和数据 API 构建了一个 wiki。 wiki 页面存储为 Google Base 的“参考文章”。我希望用户能够查看、编辑和删除项目,因此当向服务器发出请求时,客户端登录使用我的用户名和密码,并代表用户检索或编辑数据。登录代码:

client = gdata.base.service.GBaseService()
client.ssl = False
gdata.alt.appengine.run_on_appengine(client)

#EMAIL, API_KEY and PASSWORD are constants stored on the server
client.email = EMAIL
client.password = PASSWORD
client.api_key = API_KEY
client.ProgrammaticLogin()

q = gdata.base.service.BaseQuery()
q.feed = '/base/feeds/items/' + self.base_id
item = base_client.GetItem(q.ToUri())

这对我来说很好,但如果我退出我的谷歌帐户,它会返回以下错误:

'status': 401L, 'body': '<HTML>\n<HEAD>\n<TITLE>Authorization required</TITLE>

我只想让用户能够对我存储在 Base 上的数据进行 CRUD。我做错了什么?
提前致谢

【问题讨论】:

    标签: python google-app-engine login gdata-api google-base


    【解决方案1】:

    听起来,在您的客户端中注销会使您帐户的所有会话无效。您最好的选择可能是专门创建一个角色帐户供您的应用使用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多