def get_topic(self, response): #根据时间,取为下载的部分进行回复 topic_urls = sql.get_topic_ranone(self.platform, '0') url = handle_db(topic_urls)['data'][0] request = response.request.replace(url = url[0], method='get') request.callback = self.get_code #request.meta['crawled'] = url[1] request.meta['topic_url'] = url[0] #将登陆后这个response对象存起来,方便后面回调本方法,在传入这个对象 request.meta['topic_response'] = response return request
def repeat_reply(self, response): topic_urls = sql.get_topic_ranone(self.platform, '0') url = handle_db(topic_urls)['data'][0] request_topic = response.request.replace(url = url[0], callback=self.get_code) return request_topic