<legend id='0CJzN'><style id='0CJzN'><dir id='0CJzN'><q id='0CJzN'></q></dir></style></legend>

    1. <i id='0CJzN'><tr id='0CJzN'><dt id='0CJzN'><q id='0CJzN'><span id='0CJzN'><b id='0CJzN'><form id='0CJzN'><ins id='0CJzN'></ins><ul id='0CJzN'></ul><sub id='0CJzN'></sub></form><legend id='0CJzN'></legend><bdo id='0CJzN'><pre id='0CJzN'><center id='0CJzN'></center></pre></bdo></b><th id='0CJzN'></th></span></q></dt></tr></i><div id='0CJzN'><tfoot id='0CJzN'></tfoot><dl id='0CJzN'><fieldset id='0CJzN'></fieldset></dl></div>

        <small id='0CJzN'></small><noframes id='0CJzN'>

          <bdo id='0CJzN'></bdo><ul id='0CJzN'></ul>
        <tfoot id='0CJzN'></tfoot>
      1. 从 Python 运行 Scrapy

        时间:2023-11-08

          <small id='txFPG'></small><noframes id='txFPG'>

        1. <i id='txFPG'><tr id='txFPG'><dt id='txFPG'><q id='txFPG'><span id='txFPG'><b id='txFPG'><form id='txFPG'><ins id='txFPG'></ins><ul id='txFPG'></ul><sub id='txFPG'></sub></form><legend id='txFPG'></legend><bdo id='txFPG'><pre id='txFPG'><center id='txFPG'></center></pre></bdo></b><th id='txFPG'></th></span></q></dt></tr></i><div id='txFPG'><tfoot id='txFPG'></tfoot><dl id='txFPG'><fieldset id='txFPG'></fieldset></dl></div>
            <bdo id='txFPG'></bdo><ul id='txFPG'></ul>

              <tbody id='txFPG'></tbody>
          • <legend id='txFPG'><style id='txFPG'><dir id='txFPG'><q id='txFPG'></q></dir></style></legend>

            <tfoot id='txFPG'></tfoot>

                1. 本文介绍了从 Python 运行 Scrapy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I am trying to run Scrapy from Python. I'm looking at this code which (source):

                  from twisted.internet import reactor
                  from scrapy.crawler import Crawler
                  from scrapy.settings import Settings
                  from scrapy import log
                  from testspiders.spiders.followall import FollowAllSpider
                  
                  spider = FollowAllSpider(domain='scrapinghub.com')
                  crawler = Crawler(Settings())
                  crawler.configure()
                  crawler.crawl(spider)
                  crawler.start()
                  log.start()
                  reactor.run() # the script will block here
                  

                  My issue is that I'm confused on how to adjust this code to run my own spider. I have called my spider project "spider_a" which specifies the domain to crawl within the spider itself.

                  What I am asking is, if I run my spider with the following code:

                  scrapy crawl spider_a
                  

                  How do I adjust the example python code above to do the same?

                  解决方案

                  Just import it and pass to crawler.crawl(), like:

                  from testspiders.spiders.spider_a import MySpider
                  
                  spider = MySpider()
                  crawler.crawl(spider)
                  

                  这篇关于从 Python 运行 Scrapy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:configparser 在 Python 3.4 中不工作,NoSectionError 但在 PyCharm 中工作 下一篇:Debian 8 上的 Python numba/llvmlite - 我无法构建 llvmlite

                  相关文章

                  1. <tfoot id='5J7Zy'></tfoot>
                    <i id='5J7Zy'><tr id='5J7Zy'><dt id='5J7Zy'><q id='5J7Zy'><span id='5J7Zy'><b id='5J7Zy'><form id='5J7Zy'><ins id='5J7Zy'></ins><ul id='5J7Zy'></ul><sub id='5J7Zy'></sub></form><legend id='5J7Zy'></legend><bdo id='5J7Zy'><pre id='5J7Zy'><center id='5J7Zy'></center></pre></bdo></b><th id='5J7Zy'></th></span></q></dt></tr></i><div id='5J7Zy'><tfoot id='5J7Zy'></tfoot><dl id='5J7Zy'><fieldset id='5J7Zy'></fieldset></dl></div>

                      • <bdo id='5J7Zy'></bdo><ul id='5J7Zy'></ul>
                      <legend id='5J7Zy'><style id='5J7Zy'><dir id='5J7Zy'><q id='5J7Zy'></q></dir></style></legend>

                      <small id='5J7Zy'></small><noframes id='5J7Zy'>