Note that there are some explanatory texts on larger screens.

plurals
  1. POissue with gdata analytics client in python
    text
    copied!<p>I was able to successfully retrieve an OAuth access token for Google Analytics using Google's gdata python library.</p> <p>However, my attempt to use the token to access Google Analytics data is failing. Here is the relevant code snippet:</p> <pre><code>client = gdata.analytics.client.AnalyticsClient(source='myapp') client.auth_token = access_token # retrieved earlier dataQuery = gdata.analytics.client.DataFeedQuery({ 'ids': 'ga:********', 'start-date': '2011-03-23', 'end-date': '2011-04-04', 'metrics': 'ga:percentNewVisits', 'max-results': 50}) data = client.GetDataFeed(dataQuery) </code></pre> <p>I get the following stacktrace:</p> <blockquote> <p>Traceback (most recent call last):<br> File "/Library/Python/2.6/site-packages/django/core/servers/basehttp.py", line 280, in run self.result = application(self.environ, self.start_response)</p> <p>File "/Library/Python/2.6/site-packages/django/core/servers/basehttp.py", line 674, in <strong>call</strong> return self.application(environ, start_response)</p> <p>File "/Library/Python/2.6/site-packages/django/core/handlers/wsgi.py", line 248, in <strong>call</strong> response = self.get_response(request)</p> <p>File "/Library/Python/2.6/site-packages/django/core/handlers/base.py", line 141, in get_response return self.handle_uncaught_exception(request, resolver, sys.exc_info())</p> <p>File "/Library/Python/2.6/site-packages/django/core/handlers/base.py", line 100, in get_response response = callback(request, *callback_args, **callback_kwargs)</p> <p>File "/Library/Python/2.6/site-packages/django/contrib/auth/decorators.py", line 25, in _wrapped_view return view_func(request, *args, **kwargs)</p> <p>File "/Users/<strong><em>*</em>**</strong>/<em><strong></em>**<em>*</em></strong>/<em><strong></em>**</strong>/<em><strong></em>***<em></strong>/</em><strong><em>*</em>*</strong>/googleAnalyticsOauth.py", line 122, in googleAnalyticsTest data = client.GetDataFeed(dataQuery)</p> <p>File "build/bdist.macosx-10.6-universal/egg/gdata/analytics/client.py", line 77, in get_data_feed **kwargs)</p> <p>File "build/bdist.macosx-10.6-universal/egg/gdata/client.py", line 635, in get_feed **kwargs)</p> <p>File "build/bdist.macosx-10.6-universal/egg/gdata/client.py", line 265, in request uri=uri, auth_token=auth_token, http_request=http_request, **kwargs)</p> <p>File "build/bdist.macosx-10.6-universal/egg/atom/client.py", line 110, in request self.auth_token.modify_request(http_request)</p> <p>File "build/bdist.macosx-10.6-universal/egg/gdata/gauth.py", line 980, in modify_request token_secret=self.token_secret, verifier=self.verifier)</p> <p>File "build/bdist.macosx-10.6-universal/egg/gdata/gauth.py", line 604, in generate_hmac_signature next, token, verifier=verifier)</p> <p>File "build/bdist.macosx-10.6-universal/egg/gdata/gauth.py", line 565, in build_oauth_base_string urllib.quote(params[key], safe='~')))</p> <p>File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.py", line 1216, in quote res = map(safe_map.<strong>getitem</strong>, s)</p> <p>TypeError: argument 2 to map() must support iteration</p> </blockquote> <p>Anyone have any ideas what could be going wrong?</p> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload