twitter.py 文件源码

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

项目:TwitterCompetitionBot 作者: BenAllenUK 项目源码 文件源码
def VerifyCredentials(self):
        '''Returns a twitter.User instance if the authenticating user is valid.

        Returns:
          A twitter.User instance representing that user if the
          credentials are valid, None otherwise.
        '''
        if not self._oauth_consumer:
            raise TwitterError("Api instance must first be given user credentials.")
        url = '%s/account/verify_credentials.json' % self.base_url
        try:
            json = self._FetchUrl(url, no_cache=True)
        except urllib2.HTTPError, http_error:
            if http_error.code == httplib.UNAUTHORIZED:
                return None
            else:
                raise http_error
        data = self._ParseAndCheckTwitter(json)
        return User.NewFromJsonDict(data)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号