ruia/spider.py
def start(cls,
              middleware: typing.Union[typing.Iterable, Middleware] = None,
              loop=None,
              after_start=None,
              before_stop=None,
              close_event_loop=True,
              **kwargs):
        """
        Start a spider
        :param after_start: hook
        :param before_stop: hook
        :param middleware: customize middleware or a list of middleware
        :param loop: event loop
        :param close_event_loop: bool
        :return:
        """
        loop = loop or asyncio.new_event_loop()
        spider_ins = cls(middleware=middleware, loop=loop)

        # Actually start crawling
        spider_ins.loop.run_until_complete(
            spider_ins._start(
                after_start=after_start, before_stop=before_stop)
        )
        spider_ins.loop.run_until_complete(
            spider_ins.loop.shutdown_asyncgens())
        if close_event_loop:
            spider_ins.loop.close()
def start(cls,
              middleware: typing.Union[typing.Iterable, Middleware] = None,
              loop=None,
              after_start=None,
              before_stop=None,
              close_event_loop=True,
              **kwargs):
        """
        Start a spider
        :param after_start: hook
        :param before_stop: hook
        :param middleware: customize middleware or a list of middleware
        :param loop: event loop
        :param close_event_loop: bool
        :return:
        """
        loop = loop or asyncio.new_event_loop()
        spider_ins = cls(middleware=middleware, loop=loop)

        # Actually start crawling
        spider_ins.loop.run_until_complete(
            spider_ins._start(
                after_start=after_start, before_stop=before_stop)
        )
        spider_ins.loop.run_until_complete(
            spider_ins.loop.shutdown_asyncgens())
        if close_event_loop:
            spider_ins.loop.close()
Start a spider
        :param after_start: hook
        :param before_stop: hook
        :param middleware: customize middleware or a list of middleware
        :param loop: event loop
        :param close_event_loop: bool
        :return: