Basically, I have a working version of middleware to pass all requests through selenium and return HtmlResponse, the problem is I also want to have some meta data to be attached to the request which I can access in parse method of spider. For some reason I can't access it in parse method of spider, could you help me please?
middleware.py
def process_request(self, request, spider):
request = request.replace(meta={'test': 'test'})
self.driver.get(request.url)
body = self.driver.page_source
return HtmlResponse(self.driver.current_url, body=body, encoding='utf-8', request=request)
spider.py
def parse(self, response):
yield {'meta': response.meta}