ruia/spider.py
async def handle_request(self, request: Request
                             ) -> typing.Tuple[AsyncGeneratorType, Response]:
        """
        Wrap request with middleware.
        :param request:
        :return:
        """
        callback_result, response = None, None

        await self._run_request_middleware(request)
        try:
            callback_result, response = await request.fetch_callback(self.sem)
        except NotImplementedParseError as e:
            self.logger.error(e)
        except NothingMatchedError as e:
            self.logger.error(f'<Item: {str(e).lower()}>')
        except Exception as e:
            self.logger.error(f'<Callback[{request.callback.__name__}]: {e}')
        await self._run_response_middleware(request, response)
        await self._process_response(request=request, response=response)
        return callback_result, response
async def handle_request(self, request: Request
                             ) -> typing.Tuple[AsyncGeneratorType, Response]:
        """
        Wrap request with middleware.
        :param request:
        :return:
        """
        callback_result, response = None, None

        await self._run_request_middleware(request)
        try:
            callback_result, response = await request.fetch_callback(self.sem)
        except NotImplementedParseError as e:
            self.logger.error(e)
        except NothingMatchedError as e:
            self.logger.error(f'<Item: {str(e).lower()}>')
        except Exception as e:
            self.logger.error(f'<Callback[{request.callback.__name__}]: {e}')
        await self._run_response_middleware(request, response)
        await self._process_response(request=request, response=response)
        return callback_result, response
Wrap request with middleware.
        :param request:
        :return: