"Insecure HTTP requests not permitted. Use HTTPS." when trying to retrieve user with gdata 2.0.16 python library
Asked Answered
R

3

5

I'm trying to retrieve a user with the following code found in the gdata provisioning api documentation. I'm attempting this for a django 1.3 app, running gdata-2.0.16 in python2.7:

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')

For privacy, I changed the actual username to 'user_name', but that's the general gist of the code.

When the interpreter gets to the last line in the code above, I get the following error:

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>

I can't find anything in the documentation on using HTTPS instead of HTTP. What am I missing?

Rhizoid answered 2/2, 2012 at 18:41 Comment(0)
R
8

After creating the client object, execute client.ssl = True. This will cause the gdata api to use a secure connection.

Rhizoid answered 2/2, 2012 at 21:25 Comment(0)
B
0

Try patch attached to Comment 3 of the issue AppsService in Marketplace - SSL issues

Baddie answered 2/2, 2012 at 21:41 Comment(0)
E
0

adding the line after the client authentication helps client.ssl=True.

Expurgatory answered 12/3, 2013 at 9:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.