Hi, I am trying to user picasaweb api to list a users photo albums
while get the following error.
GooglePhotosException: (403L, 'Forbidden', 'Token invalid - AuthSub
token has wrong scope')

The application is running on GAE server, the main hander is given as
follows.
Dose anyone know how to solve the problem?

class Hander(webapp.RequestHandler):
    def get(self):
        next = 'http://%s' %settings.HOST_NAME
        scope = 'http://picasaweb.google.com/data/'
        photo_service = gdata.photos.service.PhotosService()
        single_use_token =
gdata.auth.extract_auth_sub_token_from_url(self.request.uri)
        if single_use_token is None:
            auth_url =
photo_service.GenerateAuthSubURL(next,scope,secure=False,session=True)
            self.response.headers['Content-Type'] = 'text/html'
            res = "<html><head><title>List Picasaweb Album</title></
head><body>\
                <a href=%s>Login In</a></body></html>" %auth_url
            self.response.out.write(res)

        else:
            photo_service.SetAuthSubToken(single_use_token)
            photo_service.UpgradeToSessionToken()
            #albums = photo_service.GetFeed('/data/feed/api/user/
defaut?kind=album')
            albums = photo_service.GetUserFeed()
            self.response.headers['Content-Type'] = 'text/plain'
            res = ''
            for album in albums.entry:
                res += 'title: %s, number: %s: id: %s\n' %
(album.title.text,album.numphotos.text,album.gphoto_id.text)
            self.response.out.write(res)

-- 
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 google-picasa-data-...@googlegroups.com.
To unsubscribe from this group, send email to 
google-picasa-data-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-picasa-data-api?hl=en.

Reply via email to