Skip to content
Advertisement

Scrapy: Passing item between methods

Suppose I have a Bookitem, I need to add information to it in both the parse phase and detail phase

JavaScript

Using the code as is would led to undefined item in the detail phase. How can I pass the item to the detail? detail(self,response,item) doesn’t seem to work.

Advertisement

Answer

There is an argument named meta for Request:

JavaScript

then in function detail, access it this way:

JavaScript

See more details here about jobs topic.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement