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
Original issue reported on code.google.com by
kevan.ca...@gmail.com
on 31 Jul 2012 at 12:29