carolinux / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
0 stars 1 forks source link

"SSL is required to perform this operation" when accessing Google analytics API #633

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Recently, a batch job of ours that uses the Google Analytics API started
failing with these errors:

    RequestError({'status': 403, 'body': '<?xml version="1.0" encoding="UTF-8"?><errors xmlns="http://schemas.google.com/g/2005"><error><domain>GData</domain><code>sslRequired</code><internalReason>SSL is required to perform this operation.</internalReason></error></errors>', 'reason': 'Forbidden'},)

For reference, the code that causes the error:

    client = gdata.analytics.service.AnalyticsDataService()
    client.ClientLogin(settings.GOOGLE_AUTH_USER, settings.GOOGLE_AUTH_PASS)
    [...]
    data = client.GetData(
            ids='ga:{0}'.format(ga_profile_id),
            dimensions='',
            metrics = ','.join(metrics),
            sort='',
            filters='',
            start_date=date,
            end_date=date,
            start_index='',
            max_results='')

The call to client.GetData triggers the exception. I've reproduced it on
version 2.0.17 of gdata-python-client. As a quick fix in our code, I
changed the initialization logic to set client.ssl = True, which seems
to resolve the issue (by, as I understand it, forcing operations to
occur over SSL). Is this expected behavior?

Original issue reported on code.google.com by kevan.ca...@gmail.com on 31 Jul 2012 at 12:29

GoogleCodeExporter commented 9 years ago
I had the same problem and worked around it the same way.

Original comment by dgl...@gmail.com on 27 Aug 2012 at 7:54