import scrapy
from bs4 import BeautifulSoup
class Spider(scrapy.Spider):
name = "crawl"
start_urls = [url]
def parse(self, response):
soup = BeautifulSoup(response.text)
print soup.prettify()
我有这大块代码。是#39; m使用scrapy,当我执行它时,我收到此错误:
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 577, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File "/vagrant_data/cars_scraper/cars_scraper/spiders/__init__.py", line 17, in parse
soup = BeautifulSoup(response.text)
exceptions.AttributeError: 'HtmlResponse' object has no attribute 'text'