本文整理汇总了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))
示例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
示例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))