Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scrapy python Request is not defined

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?

like image 304
user2226785 Avatar asked Mar 20 '23 23:03

user2226785


1 Answers

Short answer: from scrapy.http.request import Request

Extended answer: read the docs.

like image 129
Bartosz Marcinkowski Avatar answered Apr 02 '23 18:04

Bartosz Marcinkowski