scrapy python Request is not defined

老子叫甜甜 提交于 2019-12-23 15:38:12

问题


i found an answer here:

code

for site in sites:
            Link = site.xpath('a/@href').extract()
            CompleteLink = urlparse.urljoin(response.url, Link)
            yield Request(Link, callback = self.parseOneCar)

I got this exception

exceptions.NameError: global name 'Request' is not defined

what should I import please?


回答1:


Short answer: from scrapy.http.request import Request

Extended answer: read the docs.



来源:https://stackoverflow.com/questions/21121941/scrapy-python-request-is-not-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!