scrapy在spider中通过pipeline获取数据库内容
2016-12-27 00:00
330 查看
http://stackoverflow.com/questions/23105590/how-to-get-the-pipeline-object-in-scrapy-spider
# This is my Pipline class MongoDBPipeline(object): def __init__(self, mongodb_db=None, mongodb_collection=None): self.connection = pymongo.Connection(settings['MONGODB_SERVER'], settings['MONGODB_PORT']) .... def process_item(self, item, spider): .... def get_date(self): .... def open_spider(self, spider): spider.myPipeline = self class Spider(Spider): name = "test" def __init__(self): self.myPipeline = None def parse(self, response): self.myPipeline.get_date()
相关文章推荐
- Redis与KV存储(RocksDB)融合之编码方式
- PreparedStatement和CallableStatement都可以调用存储过程
- mysql case when 的用法,绝对正确,可以看效果图,适合入门。
- Mariadb用户操作/数据库基本操作 (一)
- MairDB 初始数据库与表 (二)
- MySQL5.7 InnoDB Standard Monitor and Lock Monitor Output
- mysql安装之socket连接问题
- [置顶] mysql设置用户权限
- [置顶] mysql设置用户权限
- [置顶] mysql设置用户权限
- [置顶] mysql设置用户权限
- [置顶] mysql设置用户权限
- [置顶] mysql设置用户权限
- [置顶] mysql设置用户权限
- [置顶] mysql设置用户权限
- [置顶] mysql设置用户权限
- [置顶] mysql设置用户权限
- [置顶] mysql设置用户权限
- [置顶] mysql设置用户权限
- [置顶] mysql设置用户权限