I am trying to user picasaweb api on gae to get the album list from
picasaweb.
But after authorization, I got the a 'Token invalid' error as follows:

Traceback (most recent call last):
  File "/base/python_runtime/python_lib/versions/1/google/appengine/
ext/webapp/__init__.py", line 511, in __call__
    handler.get(*groups)
  File "/base/data/home/apps/gaexpr/1.343722279234460442/main.py",
line 26, in get
    ablumes = gd_client.GetUserFeed(user='heibbai')
  File "/base/data/home/apps/gaexpr/1.343722279234460442/gdata/photos/
service.py", line 234, in GetUserFeed
    return self.GetFeed(uri, limit=limit)
  File "/base/data/home/apps/gaexpr/1.343722279234460442/gdata/photos/
service.py", line 179, in GetFeed
    raise GooglePhotosException(e.args[0])
GooglePhotosException: (403L, '', 'Token invalid - AuthSub token has
wrong scope')

Anyone knows how to solve the problem?

The request handler defined is defined as follows:
class MainPage(webapp.RequestHandler):
    def get(self):
        next = 'http://%s/' %settings.HOST_NAME
        scope = 'http://picasaweb.google.com/data/'

        secure = False
        session = True
        auth_url = gdata.auth.GenerateAuthSubUrl(next, scope,
secure=secure, session=session)

        self.response.headers['Content-Type']='text/html'
        self.response.out.write('<html><body><a href=%s>Log In</
a><ul>' %auth_url)
        single_use_token =
gdata.auth.extract_auth_sub_token_from_url(self.request.uri)
        gd_client = gdata.photos.service.PhotosService()
        if single_use_token:
            gd_client.UpgradeToSessionToken(single_use_token)
            gdata.alt.appengine.run_on_appengine(gd_client)
            ablumes = gd_client.GetUserFeed(user='heibbai')
            for ablume in ablumes.entry:
                self.response.out.write('<li>title: %s, number of
photos: %s, id: %s</li>'
                        % (album.title.text,album.numphotos.text,
album.gphoto_id.text))
        self.response.out.write('</ul></body></html>')

-- 
You received this message because you are subscribed to the Google Groups 
"Google Picasa Web Albums API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-picasa-data-api?hl=en.

Reply via email to