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


Python Actions.get_username方法代码示例

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


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

示例1: scan

# 需要导入模块: import Actions [as 别名]
# 或者: from Actions import get_username [as 别名]
    def scan(self, limit=None):
        """Scans the sub.

        :param limit: If None, the limit in the policy will be used
        :return: True if self.last_seen was reached, False otherwise
        """

        lim = limit if limit else self.policy.Posts_To_Load
        # first ask for posts
        posts = self.get_posts(lim)
        if posts is None:
            return scan_result.Error
        found_old = False

        post_data = []
        for post in posts:
            try:
                if not post.is_self:
                    post_data.append((
                        post.created_utc, post.name, post.url,
                        Actions.get_username(post), post))
            except socket.error, e:
                if e.errno == 10061:
                    logging.critical("praw-multiprocess not started!")
                else:
                    logging.error(str(e))
                return scan_result.Error
            except (HTTPError, NotFound) as e:
                # bad resolve
                logging.warn('Bad resolve for post {}'.format(post))
开发者ID:arghdos,项目名称:CentralScrutinzer-bot,代码行数:32,代码来源:ScanSub.py

示例2: historical_scan

# 需要导入模块: import Actions [as 别名]
# 或者: from Actions import get_username [as 别名]
 def historical_scan(self, goto):
     posts = self.get_historial_posts(goto)
     if posts is not None and len(posts):
         post_data = [(post.created_utc, post.name, post.url, Actions.get_username(post), post) for post in posts if not post.is_self]
         self.__process_post_list(post_data)
         return scan_result.FoundOld
     return scan_result.Error
开发者ID:arghdos,项目名称:CentralScrutinzer-bot,代码行数:9,代码来源:ScanSub.py

示例3: on_viewcount

# 需要导入模块: import Actions [as 别名]
# 或者: from Actions import get_username [as 别名]
 def on_viewcount(self, post, website, viewcount, limit):
     self.remove_and_post(post, self.format_viewcount(Actions.get_username(post), post.shortlink, website, viewcount, limit))
开发者ID:arghdos,项目名称:CentralScrutinzer-bot,代码行数:4,代码来源:Policies.py


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