【问题标题】:"Insecure HTTP requests not permitted. Use HTTPS." when trying to retrieve user with gdata 2.0.16 python library“不允许不安全的 HTTP 请求。使用 HTTPS。”尝试使用 gdata 2.0.16 python 库检索用户时
【发布时间】:2012-02-25 10:39:11
【问题描述】:

我正在尝试使用gdata provisioning api documentation 中的以下代码检索用户。我正在为django 1.3 应用程序尝试此操作,在python2.7 中运行gdata-2.0.16

from gdata.apps import client
from myapp import settings
client = client.AppsClient(domain=settings.GOOGLE_ADMIN_DOMAIN)
client.ClientLogin(email=settings.GOOGLE_ADMIN_EMAIL, password=settings.GOOGLE_ADMIN_PASSWORD, source='apps')
user_account = client.RetrieveUser('user_name')

出于隐私考虑,我将实际用户名更改为 'user_name',但这是代码的一般要点。

当解释器到达上面代码的最后一行时,我收到以下错误:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/gdata/apps/client.py", line 182, in RetrieveNickname
    return self.GetEntry(uri, desired_class=gdata.apps.data.NicknameEntry)
  File "/usr/local/lib/python2.7/dist-packages/gdata/client.py", line 652, in get_entry
    desired_class=desired_class, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/gdata/client.py", line 319, in request
    RequestError)
RequestError: Server responded with: 403, <HTML>
<HEAD>
<TITLE>Insecure HTTP requests not permitted.  Use HTTPS.</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Insecure HTTP requests not permitted.  Use HTTPS.</H1>
<H2>Error 403</H2>
</BODY>
</HTML>

我在使用 HTTPS 而不是 HTTP 的文档中找不到任何内容。我错过了什么?

【问题讨论】:

    标签: python https gdata


    【解决方案1】:

    在客户端身份验证后添加该行会有所帮助 client.ssl=真。

    【讨论】:

      【解决方案2】:

      创建客户端对象后,执行client.ssl = True。这将导致 gdata api 使用安全连接。

      【讨论】:

        【解决方案3】:

        尝试附加到问题的Comment 3 的补丁Marketplace 中的AppsService - SSL 问题

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-10-12
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2020-09-25
          • 2013-12-15
          相关资源
          最近更新 更多