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)