简体   繁体   English

从另一只蜘蛛的草率导入方法

[英]Scrapy Import Method from another Spider

So I have a scrapy project and I've written two spiders for it. 所以我有一个拼凑的项目,为此我写了两个蜘蛛。 One to scan the whole web page, and one to do daily updates. 一种扫描整个网页,另一种进行每日更新。 Is there a way I can import a method from the one the scrapes the whole web site into the one that only does daily update? 有没有一种方法可以从将整个网站抓取到每天更新的方法中导入一种方法? I'm not very good with the whole module import thing to begin with. 一开始我对整个模块的导入情况不太满意。

This is what the project structure looks like 这是项目结构的样子

/Myproject
      __init__.py items.py piplines.py settings.py
    /spiders
        spiderA.py spiderB.py __init__.py

I've tried 我试过了

from Myproject.spiders.spiderA import theMethod

To no avail. 无济于事。

尝试:

from spiderA import theMethod

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM