当前位置: 首页>>代码示例>>Python>>正文


Python API.user_timeline方法代码示例

本文整理汇总了Python中api.API.user_timeline方法的典型用法代码示例。如果您正苦于以下问题:Python API.user_timeline方法的具体用法?Python API.user_timeline怎么用?Python API.user_timeline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在api.API的用法示例。


在下文中一共展示了API.user_timeline方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SinaAPI

# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import user_timeline [as 别名]

#.........这里部分代码省略.........
                rvl.extend(status)
        return rvl

    def getFriendsIds(self, uid=None, screen_name=None, count=200):
        logger.info('api-nail')
        cursor = 0
        rvl=[]
        while True:
            self._testResetTime()
            if self.request_limit < 1:
                raise TooManyRequests('Too many requests in getFriendsIds')
            self.request_limit -= 1
            try:
                status = self.api.friends_ids(
                    uid=uid,
                    cursor=cursor,
                    count=count,
                )
            except WeibopError:
                logger.info("WeibopError") 
                return rvl
            if len(status.ids) == 0:
                break;
            else:
                cursor += len(status.ids)
                rvl.extend(status.ids)
        return rvl

    
    @check_remain_requests('Too many requests in getUserTimeline')
    def getUserTimeline(self, uid=None, since_id=None, count=200, page=1):
        logger.info('api-nail')
        if uid is None and since_id is None:
            return self.api.user_timeline(count=count, page=page)
        else:
            return self.api.user_timeline(uid=uid, since_id=since_id, count=count, page=page)


    @check_remain_requests('Too many requests in getUserTimeline')
    def getPublicTimeline(self, since_id=None, count=200, page=1):
        logger.info('api-nail')
        return self.api.public_timeline(
            since_id=since_id,
            count=count,
            page=page,
        )


    @check_remain_requests('Too many requests in getUserTimeline')
    def getUsersCount(self, uids):
        logger.info('api-nail')
        return self.api.users_count(uids=uids)


    @check_remain_requests('Too many requests in getUserTimeline')
    def getCounts(self, ids):
        logger.info('api-nail')
        return self.api.counts(ids=ids)

    @check_remain_requests('Too many requests in getRepostTimeline')
    def getRepostTimeline(
        self,
        status_id,
        since_id=None,
        max_id=None,
        count=200,
开发者ID:seraphlnWu,项目名称:weibosdk,代码行数:70,代码来源:sinaapi.py


注:本文中的api.API.user_timeline方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。