1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-21 07:52:49 +00:00

Move an import to postpone another "import twisted.internet.reactor".

This commit is contained in:
Andrey Rakhmatullin 2019-12-04 21:53:07 +05:00
parent ed34ce14c0
commit 97fb61cec8

View File

@ -6,7 +6,6 @@ See documentation in docs/topics/shell.rst
from threading import Thread
from scrapy.commands import ScrapyCommand
from scrapy.shell import Shell
from scrapy.http import Request
from scrapy.utils.spider import spidercls_for_request, DefaultSpider
from scrapy.utils.url import guess_scheme
@ -70,6 +69,8 @@ class Command(ScrapyCommand):
self._start_crawler_thread()
# moved from the top-level because it imports twisted.internet.reactor
from scrapy.shell import Shell
shell = Shell(crawler, update_vars=self.update_vars, code=opts.code)
shell.start(url=url, redirect=not opts.no_redirect)