As per step 3, unable to authenticate
Getting the following errors when trying to authenticate. In the GA API manager, I set it up as Client ID for Other but I cannot even make it to the token page as I get the below error after inputting my Client ID and Secret.
File "/usr/local/bin/googleanalytics", line 6, in <module>
cli()
File "/Library/Python/2.7/site-packages/click/core.py", line 610, in __call__
return self.main(*args, **kwargs)
File "/Library/Python/2.7/site-packages/click/core.py", line 590, in main
rv = self.invoke(ctx)
File "/Library/Python/2.7/site-packages/click/core.py", line 933, in invoke
Command.invoke(self, ctx)
File "/Library/Python/2.7/site-packages/click/core.py", line 782, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Python/2.7/site-packages/click/core.py", line 416, in invoke
return callback(*args, **kwargs)
File "/Library/Python/2.7/site-packages/googleanalytics/commands/common.py", line 23, in cli
save=True)
File "/Library/Python/2.7/site-packages/googleanalytics/auth/__init__.py", line 95, in authenticate
accounts = oauth.authenticate(credentials)
File "/Library/Python/2.7/site-packages/googleanalytics/auth/credentials.py", line 216, in normalized_fn
return fn(credentials)
File "/Library/Python/2.7/site-packages/googleanalytics/auth/oauth.py", line 44, in authenticate
raw_accounts = service.management().accounts().list().execute()['items']
File "/Library/Python/2.7/site-packages/oauth2client/util.py", line 140, in positional_wrapper
return wrapped(*args, **kwargs)
File "/Library/Python/2.7/site-packages/googleapiclient/http.py", line 722, in execute
body=self.body, headers=self.headers)
File "/Library/Python/2.7/site-packages/oauth2client/client.py", line 607, in new_request
self._refresh(request_orig)
File "/Library/Python/2.7/site-packages/oauth2client/client.py", line 842, in _refresh
self._do_refresh_request(http_request)
File "/Library/Python/2.7/site-packages/oauth2client/client.py", line 869, in _do_refresh_request
body = self._generate_refresh_request_body()
File "/Library/Python/2.7/site-packages/oauth2client/client.py", line 807, in _generate_refresh_request_body
body = urllib.parse.urlencode({
AttributeError: 'Module_six_moves_urllib_parse' object has no attribute 'urlencode'
Hmm, maybe try downloading the very latest https://github.com/google/oauth2client. This isn't the first time Google has had trouble making their libraries fully Python2/3 compatible.
It would also be interesting to see if you have this same problem on Python 3 – I know you might not be able to use Python 3 for your project, but it would clarify whether it is indeed a compatibility problem (which is what it looks like) or something else.
Thanks. Will give it a go and provide update.
New Year, finally got around to testing this. I ran into the same issue with python 3 as with 2.7.
The error I get specifically, Error: no such option: --identity
It goes into the authentication screen in the browser, where it reads auth complete, but in the Command line it fails. I am assuming it has something to do with the token. Worth mentioning, using the same credentials with the Google google-api-python-client it works just fine with authentication.
I am on Mac OS X running El Capitan and using Conda so have diff py versions running on separate .env.
What is the exact command you're running on the command line?
googleanalytics authorize --identity myproject
It starts the authentication with Command Line line - human readable *.. but fails at the end when it tries authenticating in the browser.
Thanks, I'll dig into it.
Is there any news on this? I've run into the same issue, getting Error: no such option: --identity running the googleanalytics authorize --identity myproject command on the command line. Any help appreciated.