service.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:gdata-python3 作者: dvska 项目源码 文件源码
def UpgradeToSessionToken(self, token=None):
        """Upgrades a single use AuthSub token to a session token.

        Args:
          token: A gdata.auth.AuthSubToken or gdata.auth.SecureAuthSubToken
                 (optional) which is good for a single use but can be upgraded
                 to a session token. If no token is passed in, the token
                 is found by looking in the token_store by looking for a token
                 for the current scope.

        Raises:
          NonAuthSubToken if the user's auth token is not an AuthSub token
          TokenUpgradeFailed if the server responded to the request with an
          error.
        """
        if token is None:
            scopes = lookup_scopes(self.service)
            if scopes:
                token = self.token_store.find_token(scopes[0])
            else:
                token = self.token_store.find_token(atom.token_store.SCOPE_ALL)
        if not isinstance(token, gdata.auth.AuthSubToken):
            raise NonAuthSubToken

        self.SetAuthSubToken(self.upgrade_to_session_token(token))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号