carolinux / gdata-python-client

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

Bug in documentation example for generate_authorization_url #527

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
See the Python example here:
http://code.google.com/apis/gdata/docs/auth/oauth.html#OAuthAuthorizeToken

This code from the example doesn't work:
domain = None  # If on a Google Apps domain, use your domain (e.g. 
'example.com').
self.redirect(request_token.generate_authorization_url(google_apps_domain=domain
))

But this does:

self.redirect(request_token.generate_authorization_url())

Looking at the code for generate_authorization_url(), the default argument to 
domain is the string 'default'. This is what you should use instead of None 
when you aren't using a Google Apps domain.

This is with version 2.0 of the API but I think it exists with 1.0 also.

Thanks.

Original issue reported on code.google.com by bgn...@gmail.com on 5 Jul 2011 at 12:05

GoogleCodeExporter commented 9 years ago

Original comment by afs...@google.com on 7 Oct 2011 at 12:34

GoogleCodeExporter commented 9 years ago
Actually, to get the example to work, I had to use: 
self.redirect(str(request_token.generate_authorization_url()))

otherwise I got the following error:
ERROR    2011-12-08 16:05:32,209 _webapp25.py:464] 'Uri' object has no 
attribute 'find'
Traceback (most recent call last):
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/_webapp25.py", line 701, in __call__
    handler.get(*groups)
  File "/Users/tap32/Programming/dataserver/login.py", line 27, in get
    self.redirect(request_token.generate_authorization_url(google_apps_domain=domain))
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/_webapp25.py", line 449, in redirect
    absolute_url = urlparse.urljoin(self.request.uri, uri)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urlparse.py", line 236, in urljoin
    urlparse(url, bscheme, allow_fragments)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urlparse.py", line 129, in urlparse
    tuple = urlsplit(url, scheme, allow_fragments)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urlparse.py", line 168, in urlsplit
    i = url.find(':')
AttributeError: 'Uri' object has no attribute 'find'

Original comment by personal...@gmail.com on 8 Dec 2011 at 4:14

GoogleCodeExporter commented 9 years ago

Original comment by afs...@google.com on 18 Dec 2011 at 5:46