Ejemplo n.º 1
0
 def __init__(self):
     mongo_url = global_config.get('config', 'mongo_path')
     try:
         import pymongo
         client = pymongo.MongoClient(mongo_url)
         self.database = client['dianping']
     except:
         logger.warning(
             u'系统中可能没有安装或启动MongoDB数据库,请先根据系统环境安装或启动MongoDB,再运行程序')
         sys.exit()
Ejemplo n.º 2
0
 def __init__(self):
     save_mode = global_config.get('config', 'save_mode')
     self.saver_list = []
     # 构造每个存储方法的存储器
     if 'csv' in save_mode:
         pass
     if 'mongo' in save_mode:
         from utils.saver.mongo_saver import MongoSaver
         mongo_saver = MongoSaver()
         self.saver_list.append(mongo_saver)
         pass