The code that I can't get to understand is from here:
def parse_page1(self, response):
item = MyItem()
item['main_url'] = response.url
request = scrapy.Request("http://www.example.com/some_page.html",
callback=self.parse_page2)
request.meta['item'] = item
yield request
def parse_page2(self, response):
item = response.meta['item']
item['other_url'] = response.url
yield item
From one of the stackoverflow answers I can get a basic idea at what time the lines around yield keyword are executed. But the code above is too difficult for me because of its seemingly nested yield.
Can you explain the interaction between the two yield and the callback mechanism? Specifically, how are these lines triggered to execute?
Thanks.