(self, result: Union[Response, Failure], request: Request, spider: Spider)
return dfd
Handle the downloaded response or failure through the spider callback/errback
Handle the downloaded response or failure through the spider callback/errback
Handle the downloaded response or failure through the spider callback / errback
def _scrape(self, result: Union[Response, Failure], request: Request, spider: Spider) -> Deferred:
        """
        Handle the downloaded response or failure through the spider callback/errback
        """
        if not isinstance(result, (Response, Failure)):
            raise TypeError(f"Incorrect type: expected Response or Failure, got {type(result)}: {result!r}")
        dfd = self._scrape2(result, request, spider)  # returns spider's processed output
        dfd.addErrback(self.handle_spider_error, request, result, spider)
        dfd.addCallback(self.handle_spider_output, request, result, spider)
        return dfd
def _scrape ( self , result : Union [ Response , Failure ] , request : Request , spider : Spider ) -> Deferred : if not isinstance ( result , ( Response , Failure ) ) : raise TypeError ( f"Incorrect type: expected Response or Failure, got {type(result)}: {result!r}" ) dfd = self . _scrape2 ( result , request , spider ) # returns spider's processed output dfd . addErrback ( self . handle_spider_error , request , result , spider ) dfd . addCallback ( self . handle_spider_output , request , result , spider ) return dfd