本文整理汇总了Python中models.comment.Comment.commentId方法的典型用法代码示例。如果您正苦于以下问题:Python Comment.commentId方法的具体用法?Python Comment.commentId怎么用?Python Comment.commentId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.comment.Comment
的用法示例。
在下文中一共展示了Comment.commentId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sleep
# 需要导入模块: from models.comment import Comment [as 别名]
# 或者: from models.comment.Comment import commentId [as 别名]
comment.reply(commandResponse)
girmRequestsToFind = re.findall(r'\[\s*girm\s*([\d\-,\s]+)\s*\\?\](?im)(?!\()', comment.body)
if girmRequestsToFind:
requestIsValid,commandResponse = girmResponse.getResponse(girmRequestsToFind)
if requestIsValid:
try:
comment.reply(commandResponse)
except praw.exceptions.APIException as e:
if e.error_type == "RATELIMIT":
logger.warning("Sleeping 90 seconds due to RateLimitExceed ")
sleep(90)
comment.reply(commandResponse)
try:
# db.connection().enable_query_log()
logger.info("Cleaning database of old comments")
db.table('comments').where('utcTime', '<', time.time() - 31*24*60*60).delete()
dbComment = Comment()
dbComment.commentId = comment.id
dbComment.utcTime = time.time()
dbComment.save()
logger.info("Inserting comment %s by user %s into database" % (comment.id, comment.author.name))
except:
logger.critical("Database insert for comment %s by user %s failed." % (comment.id, comment.author.name),sys.exc_info()[0],"x")
exit()
except requests.exceptions.HTTPError:
logger.error("HTTP Error: waiting 5 minutes to retry"+sys.exc_info()[0],"e")
sleep(5*60)