scrapy crawling some sites appear Code .txt AttributeError_ object solution has no attribute of

The content segment the process of writing content is often used to back up a bit, the following contents are about scrapy crawling some sites appear AttributeError: & # 39; Response & # 39; object has no attribute & # 39; body_as_unicode & # 39; solution content approach should also be useful for code growers.

 

def parse(self, response):
hxs=Selector(response)

for url in detail_url_list:
if 'goods' in url:
yield Request(url, callback=self.parse_detail)





The following can be written like this



def parse(self, response):
hxs=Selector(text=response.body)

for url in detail_url_list:
if 'goods' in url:
yield Request(url, callback=self.parse_detail)





Note this sentence: hxs = Selector (text = response.body)





Guess you like

Origin www.cnblogs.com/gladiolus/p/11257632.html