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


Python API.comments方法代码示例

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


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

示例1: update_comments

# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import comments [as 别名]
def update_comments(itemid, cache_minutes=20):
    try:
        # cachetime = HNCommentsCache.objects.get(pk=itemid).time
        cachetime = HNComments.objects.get(pk=itemid).cache
    except HNComments.DoesNotExist:
        try:
            cachetime = Stories.objects.get(pk=itemid).cache
        except Stories.DoesNotExist:
            # Force updating cache
            cachetime = timezone.now() - datetime.timedelta(days=1)
    if not cachetime or cachetime + datetime.timedelta(minutes=cache_minutes) < timezone.now():
        API.comments(itemid=itemid, cache_minutes=cache_minutes)
        return None
    else:
        return cachetime
开发者ID:duvholt,项目名称:Hacker-News-Reader,代码行数:17,代码来源:cache.py

示例2: SinaAPI

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

#.........这里部分代码省略.........
    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,
        page=1,
        filter_by_author=0,
    ):
        logger.info('api-nail')
        return self.api.repost_timeline(
            id=status_id,
            since_id=since_id,
            max_id=max_id,
            count=count,
            page=page,
            filter_by_author=filter_by_author,
        )

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

    @check_remain_requests('Too many requests in getCommentsToMe')
    def getCommentsShow(
        self,
        id,
        since_id=None,
        max_id=None,
        count=200,
        page=1,
        filter_by_author=0,
    ):
        logger.info('api-nail')
        if count > 200:
            raise Exception("Too many statuses counts per page.")
        
        return self.api.comments_show(
            id=id,
            since_id=since_id,
            max_id=max_id,
            count=count,
            page=page,
            filter_by_author=filter_by_author,
        )


    @check_remain_requests('Too many requests in getCommentsToMe')
    def getShortStatus(self, url_short):
        '''
            获取短链的微博分享数
        '''
        return self.api.short_status(url_short=url_short)
        
开发者ID:seraphlnWu,项目名称:weibosdk,代码行数:69,代码来源:sinaapi.py


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