def __init__(self, type): self.config = ConfigProvider('LianJiaConfig.cfg') self.is_csv = self.config.get('data', 'csv') self.is_db = self.config.get('data', 'db') self.type = type if self.is_db == 'ON': self.con, self.cursor = self.prepare() self.dbinit()
def __init__(self, typeName, configName): self.type = typeName self.config = ConfigProvider(configName) if self.type == 'sale': self.link = '.lianjia.com/ershoufang/' elif self.type == 'deal': self.link = '.lianjia.com/chengjiao/' else: self.link = '' logging.warning('输入类型错误,需要为sale或者deal')