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

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

                  相关文档推荐

                  groupby multiple coords along a single dimension in xarray(在xarray中按单个维度的多个坐标分组)
                  Group by and Sum in Pandas without losing columns(Pandas中的GROUP BY AND SUM不丢失列)
                  Group by + New Column + Grab value former row based on conditionals(GROUP BY+新列+基于条件的前一行抓取值)
                  Groupby and interpolate in Pandas(PANDA中的Groupby算法和插值算法)
                  Pandas - Group Rows based on a column and replace NaN with non-null values(PANAS-基于列对行进行分组,并将NaN替换为非空值)
                  Grouping pandas DataFrame by 10 minute intervals(按10分钟间隔对 pandas 数据帧进行分组)
                      <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'>