如何使用gdatapython更新访问令牌

如何使用gdatapython更新访问令牌,python,oauth-2.0,gdata,picasa,Python,Oauth 2.0,Gdata,Picasa,我正在尝试将我的picasa应用程序切换到oauth2.0 from gdata.gauth import OAuth2Token token = OAuth2Token( client_id=client_id, client_secret=client_secret, scope=scope, user_agent=useragent) url = token.generate_authorize_ur

我正在尝试将我的picasa应用程序切换到oauth2.0

    from gdata.gauth import OAuth2Token
    token = OAuth2Token(
        client_id=client_id,
        client_secret=client_secret,
        scope=scope,
        user_agent=useragent)

    url = token.generate_authorize_url(redirect_uri='urn:ietf:wg:oauth:2.0:oob', approval_prompt='force', access_type="offline")

    print url

    code = raw_input('code:')
    token.get_access_token(code)
然后,我得到了访问令牌

access_token = token.access_token
当我想要专辑时:

albums = gd_client.GetFeed("https://picasaweb.google.com/data/feed/api/user/default?access_token="+access_token)
print albums
问题出在这里。访问令牌将在短时间内过期,我将收到错误消息

(403)令牌无效-无效令牌:找不到令牌-禁止

我试了很多方法,但没有成功。 请帮我把这个修好。谢谢