I am new to Python and I am trying to write an extension for an application that imports GA information and parses it into MySQL. A rather small amount of information is presented on this topic. Google Docs only have examples in JS and Java ...
... I have come to the point that my user can authenticate to GA using SubAuth. This code is here:
import gdata.service
import gdata.analytics
from django import http
from django import shortcuts
from django.shortcuts import render_to_response
def authorize(request):
next = 'http://localhost:8000/authconfirm'
scope = 'https://www.google.com/analytics/feeds'
secure = False
session = False
auth_sub_url = gdata.service.GenerateAuthSubRequestUrl(next, scope, secure=secure, session=session)
return http.HttpResponseRedirect(auth_sub_url)
So, a step further goes according to the data. I found this library: (beware, the user interface is offensive) http://gdata-python-client.googlecode.com/svn/trunk/pydocs/gdata.analytics.html
However, it was difficult for me to navigate. It seems that I should be gdata.analytics.AnalyticsDataEntry.getDataEntry (), but I'm not sure if he asks me to pass it.
. , Google, .
!
: , . ( ).... , : "str" "_BecomeChildElement" " , ? , . ?
def auth_confirm(request):
gdata_service = gdata.service.GDataService('iSample_acctSample_v1.0')
feedUri='https://www.google.com/analytics/feeds/accounts/default?max-results=50'
feed = gdata.analytics.AnalyticsDataFeed(feedUri)
print str(feed)