シェルの間に設定モジュールが読み込まれていないと思います。それはそれの言及を持っていない
https://doc.scrapy.org/en/latest/topics/shell.html
以下のドキュメントを参照してください。ただし、DebugSpiderを作成し、そこにあなたのURLを立ち上げてデバッグシェルを起動することができます。だから、
これはまたあなたの設定モジュールをロードし、要求を作成し、あなたに
2017-09-12 00:16:27 [scrapy.core.engine] DEBUG: Crawled (200) <GET http://tarunlalwani.com> (referer: None)
[s] Available Scrapy objects:
>>> [s] scrapy scrapy module (contains scrapy.Request, scrapy.Selector, etc)
[s] crawler <scrapy.crawler.Crawler object at 0x10562b748>
[s] item {}
[s] request <GET http://tarunlalwani.com>
[s] response <200 http://tarunlalwani.com>
[s] settings <scrapy.settings.Settings object at 0x106432c50>
[s] Useful shortcuts:
[s] shelp() Shell help (print this help)
[s] view(response) View response in a browser
を同じデバッグシェルを与える、端末の実行から次に
class DebugSpider(scrapy.Spider):
name = "debug"
def __init__(self, url=None):
if url is None:
raise Exception("Please specify a url using -a url=....")
self.start_urls = [url]
def parse(self, response):
from scrapy.shell import inspect_response
inspect_response(response, self)
あなたのクモのコードに以下の
scrapy crawl debug -a url="http://tarunlalwani.com"
を追加します