<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

        Scrapy run from Python(从 Python 运行 Scrapy)

          <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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What happens when you compare 2 pandas Series(当你比较 2 个 pandas 系列时会发生什么)
                  Quickly find differences between two large text files(快速查找两个大文本文件之间的差异)
                  Python - Compare 2 files and output differences(Python - 比较 2 个文件和输出差异)
                  Why do comparisions between very large float values fail in python?(为什么在 python 中非常大的浮点值之间的比较会失败?)
                  Dictionary merge by updating but not overwriting if value exists(字典通过更新合并,但如果值存在则不覆盖)
                  Find entries of one text file in another file in python(在python中的另一个文件中查找一个文本文件的条目)
                      <tbody id='5J7Zy'></tbody>
                  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'>