salimoha / googlecl

Automatically exported from code.google.com/p/googlecl
0 stars 0 forks source link

KeyError: 'email' -- File "/usr/lib/pymodules/python2.7/googlecl/base.py", line 160, in get_email #399

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. remove all local configs
2. google docs list
3. enter auth token

What is the expected output? What do you see instead?
Instead of getting a documents list, I get:
Please specify user: foo@gmail.com
Please log in and/or grant access at 
https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token=4%xyz-xyz&hd=xyz
Nouvelle fenêtre ouverte dans la session du navigateur
Please enter the verification code on the success page: xzxyzxyz
Traceback (most recent call last):
  File "/usr/bin/google", line 839, in <module>
    main()
  File "/usr/bin/google", line 825, in main
    run_once(options, args)
  File "/usr/bin/google", line 605, in run_once
    authenticated = authenticate(auth_manager, options, config, section_header)
  File "/usr/bin/google", line 119, in authenticate
    valid_token = auth_manager.retrieve_access_token(display_name, browser)
  File "/usr/lib/pymodules/python2.7/googlecl/authentication.py", line 175, in retrieve_access_token

What version of the product are you using? On what operating system? What
version of gdata-python-client (aka python-gdata)?
.deb version 2.0.14-2 from Ubuntu (currently identical source as Debian package)

Please provide any additional information below.
I've confirmed that the patch from issue 352 is already included.

Adding some print debug statements, I see that the parsed return document of 
get_email() has:
{'data.email': ['foo@gmail.com'], 'data.isVerified': ['true']}

Note: "data.email", not "email"

Changing the code to read:
email = param_dict['data.email'][0]
fixes the problem for me.

It seems like a server side API change, so either this should get reverted 
server-side, or googlecl should move to the new API.

I recently enabled multiple-logins in my google account preferences; maybe this 
influence the API results?  In which case, it would be best to support both 
"email" and "data.email"; perhaps something like
email = param_dict.get('data.email', param_dict['email'])[0]
(untested)

Cheers,

Original issue reported on code.google.com by loic.min...@gmail.com on 21 Jun 2011 at 9:12

GoogleCodeExporter commented 9 years ago
NB: I also recently trashed my local auth tokens, but I don't think that's 
related:
rm ~/.googlecl/access_tok_*@*

Original comment by loic.min...@gmail.com on 21 Jun 2011 at 9:13

GoogleCodeExporter commented 9 years ago
I think this issue has been resolved at server-side since I can't reproduce the 
problem.

Original comment by livibet...@gmail.com on 7 Aug 2011 at 4:35

GoogleCodeExporter commented 9 years ago
I cannot reproduce this as well, using code from trunk, so we may assume it is 
not a valid bug report at this moment.

Original comment by szy...@endpoint.com on 29 Dec 2012 at 6:50