doingmybest
doingmybest

Reputation: 314

difference between response.selector.xpath and response.xpath

From a performance standpoint, I would like to know the difference between

response.selector.xpath

and

response.xpath

Is there a case where a new http request is made and not the other one?

Thanks

Upvotes: 0

Views: 89

Answers (1)

They are the same.

If you look into Scrapy code, response.xpath() actually uses selector.xpath().

def xpath(self, query, **kwargs):
    return self.selector.xpath(query, **kwargs)

Is there a case where a new http request is made and not the other one?

Neither one generate a new http request.

Upvotes: 2

Related Questions