【发布时间】:2014-12-16 20:50:23
【问题描述】:
我有一个scrapy pipelines.py,我想得到给定的参数。在我的 spider.py 中完美运行:
class MySpider( CrawlSpider ):
def __init__(self, host='', domain_id='', *args, **kwargs):
super(MySpider, self).__init__(*args, **kwargs)
print user_id
...
现在,我需要我的 pipelines.py 中的“user_id”来创建像“domain-123.db”这样的 sqlite 数据库。我在整个网络上搜索我的问题,但找不到任何解决方案。
有人可以帮我吗?
PS:是的,我在管道类中尝试了 super() 函数,例如 spyer.py,它不起作用。
【问题讨论】:
标签: python web-scraping arguments scrapy scrapy-spider