def reply_status(self, response): #重新返回首页,对特别是需要回复的模块特别有用,而不需要回复的帖子缺对性能是个损失. #查询回复状态 success = u'非常感谢,你的回复已经发布'.encode('gbk', 'ignore') status = re.findall(success, response.body) username_sql = sql.select_accountbyusername(self.username, self.platform) #回复数量限制 failture = u'对不起,您所在的用户组每小时限制发帖 '.encode('gbk', 'ignore') failture_status = re.findall(failture, response.body, re.I) if failture_status: return if status: log.msg('reply success', log.INFO) reply_nums = handle_db(username_sql)['data'][0] self.point_num = reply_nums[5] self.reply_num = reply_nums[-2] self.reply_num += 1 self.point_num += 1 #回复成功.账号reply_num+1,积分+1 try: update_replynum = sql.update_account_username(self.username, self.platform, self.reply_num, self.point_num) update_success = handle_db(update_replynum) log.msg(('<username: %s \'s integral is : +1 ,now integral is %s>' % (self.username, self.reply_num)), log.INFO) except Exception, e: log.msg(str(traceback.print_exc()), log.ERROR)
def reply_status(self, response): #重新返回首页,对特别是需要回复的模块特别有用,而不需要回复的帖子缺对性能是个损失. #查询回复状态 success = u'非常感谢,你的回复已经发布'.encode('gbk', 'ignore') status = re.findall(success, response.body) username_sql = sql.select_accountbyusername(self.username, self.platform) print 'status', status #回复数量限制 failture = u'对不起,您所在的用户组每小时限制发帖 '.encode('gbk', 'ignore') failture_status = re.findall(failture, response.body, re.I) if failture_status: print u'对不起,您所在的用户组每小时限制发帖 ' return if status: log.msg('reply success', log.INFO) reply_nums = handle_db(username_sql)['data'][0] self.point_num = reply_nums[5] self.reply_num = reply_nums[-2] self.reply_num += 1 self.point_num += 1 #回复成功.账号reply_num+1,积分+1 try: update_replynum = sql.update_account_username(self.username, self.platform, self.reply_num, self.point_num) update_success = handle_db(update_replynum) log.msg(('<username: %s \'s integral is : +1 ,now integral is %s>' % (self.username, self.reply_num)), log.INFO) #回复成功,执行下载 url = response.request.meta['topic_url'] print u'回复成功主题:url---->', url #回复成功,重新进入topic页 self.topic_reply_num -= 1 log.msg(('reply success, will download software%s' % str(self.topic_reply_num)), log.DEBUG) log.msg(str(response), log.DEBUG) request = self.get_down_topic(response, url) return request except Exception, e: log.msg(str(traceback.print_exc()), log.ERROR) #重调get_topic.同时REPLY_NUM-1,当REPLY_NUM<1时,不在做任何事情. self.topic_reply_num -= 1 log.msg(('reply success, will download software', str(self.topic_reply_num)), log.DEBUG) log.msg(str(response), log.DEBUG) request_topic = self.repeat_reply(response) return request_topic
def reply_status(self, response): #重新返回首页,对特别是需要回复的模块特别有用,而不需要回复的帖子缺对性能是个损失. #查询回复状态 success = '非常感谢,您的回复已经发布' status = re.findall(success, response.body) username_sql = sql.select_accountbyusername(self.username, self.platform) if status: log.msg('reply success', log.INFO) reply_nums = handle_db(username_sql)['data'][0] self.point_num = reply_nums[5] self.reply_num = reply_nums[-2] self.reply_num += 1 self.point_num += 1 #回复成功.账号reply_num+1,积分+1 try: update_replynum = sql.update_account_username(self.username, self.platform, self.reply_num, self.point_num) update_success = handle_db(update_replynum) log.msg(('<username: %s \'s integral is : +1 ,now integral is %s>' % (self.username, self.reply_num)), log.INFO) except Exception, e: log.msg(str(traceback.print_exc()), log.ERROR)
def reply_status(self, response): #重新返回首页,对特别是需要回复的模块特别有用,而不需要回复的帖子缺对性能是个损失. #查询回复状态 success = '非常感谢,您的回复已经发布' status = re.findall(success, response.body) print self.username username_sql = sql.select_accountbyusername(self.username, self.platform) if status: print 'reply success' reply_nums = handle_db(username_sql)['data'][0] self.reply_num = reply_nums[-2] self.reply_num += 1 #回复成功.账号reply_num+1 try: now_time = time.strftime('%Y-%m-%d %H:%M:%S') update_replynum = sql.update_account_username(self.username, now_time, self.platform, self.reply_num) update_success = handle_db(update_replynum) print update_success print 'update success! user\'s reply_num + 1' except Exception, e: traceback.print_exc()