beti98 / google-api-python-client

Automatically exported from code.google.com/p/google-api-python-client
Other
0 stars 0 forks source link

Error of response key in the oauth2.py with first mode #324

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I downloaded the sample from 
http://google-mail-oauth2-tools.googlecode.com/svn/trunk/python/oauth2.py
2. I created my client id in console
3. I launched the script in the first mode : 1. The first mode is used to 
generate and authorize an OAuth2 token, the first step in logging in via OAuth2.

What is the expected output? What do you see instead?

instead of some correct output, error is displayed :

Traceback (most recent call last):
  File "D:\test\oauth2.py", line 336, in <module>
    main(sys.argv)
  File "D:\test\oauth2.py", line 316, in main
    print 'Refresh Token: %s' % response['refresh_token']
KeyError: 'refresh_token'

What version of the product are you using? On what operating system?
oauth2.py from 
http://google-mail-oauth2-tools.googlecode.com/svn/trunk/python/oauth2.py with 
py2.7
on windows 8

After print the http response , I found the real response is like :
{u'access_token': u'ya29.1.[..........]', u'token_type': u'Bearer', 
u'expires_in': 3589}

but on line 315 you have a print 'Refresh Token: %s' % 
response['refresh_token'], which is not a part of http response 

Original issue reported on code.google.com by petitch...@gmail.com on 4 Feb 2014 at 12:10