Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 381
Nathan Jones Avatar asked Feb 02 '12 18:02

Nathan Jones


1 Answers

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

like image 158
Nathan Jones Avatar answered Nov 01 '22 19:11

Nathan Jones