def __getnextsection(self): logging.info('get next section, title: %s category: %s, category id: %s, currentpage: %s, currentsection'%(self. title ,self.category, self.bookid, self.currentpage, self.currentsection)) if self.section >= self.sectionlimit: return False if self.currentsection == self.singlepagelimit: self.currentpage += 1 self.section+=1 self.currentsection = 2 self.__getfirstsection() return self.items.qsize()>0 self.payload['section'] = self.currentsection response = Util.http_post(config.url['ajaxbook'], self.payload) self.currentsection+=1 self.section+=1 if not response: logging.warning('getnextsection response null, payload: %s'%self.payload) return False try: items = json.loads(response) if 'result' not in items or 'list' not in items['result'] or not items['result']['list']: logging.warning('getnextsection list null, payload: %s'%self.payload) return False else: items = items['result']['list'] for item in items: self.items.put(item) return self.items.qsize>0 except Exception, ex: logging.exception('getnextsection exception: %s'%self.payload) return False
def __getnextsection(self): logging.info( 'get next section, title: %s category: %s, category id: %s, currentpage: %s, currentsection' % (self.title, self.category, self.bookid, self.currentpage, self.currentsection)) if self.section >= self.sectionlimit: return False if self.currentsection == self.singlepagelimit: self.currentpage += 1 self.section += 1 self.currentsection = 2 self.__getfirstsection() return self.items.qsize() > 0 self.payload['section'] = self.currentsection response = Util.http_post(config.url['ajaxbook'], self.payload) self.currentsection += 1 self.section += 1 if not response: logging.warning('getnextsection response null, payload: %s' % self.payload) return False try: items = json.loads(response) if 'result' not in items or 'list' not in items[ 'result'] or not items['result']['list']: logging.warning('getnextsection list null, payload: %s' % self.payload) return False else: items = items['result']['list'] for item in items: self.items.put(item) return self.items.qsize > 0 except Exception, ex: logging.exception('getnextsection exception: %s' % self.payload) return False