def append_by_csvs(self, market_situations_path, buy_offer_path, csv_merchant_id=None):
with open(market_situations_path, 'r') as csvfile:
has_header = csv.Sniffer().has_header(csvfile.read(16384))
csvfile.seek(0)
if has_header:
situation_data = csv.DictReader(csvfile)
else:
situation_data = csv.DictReader(csvfile, fieldnames=get_market_situation_fieldnames())
for line in situation_data:
self.append_marketplace_situations(line, csv_merchant_id)
self.update_timestamps()
with open(buy_offer_path, 'r') as csvfile:
has_header = csv.Sniffer().has_header(csvfile.read(16384))
csvfile.seek(0)
if has_header:
buy_offer_data = csv.DictReader(csvfile)
else:
buy_offer_data = csv.DictReader(csvfile, fieldnames=get_buy_offer_fieldnames())
for line in buy_offer_data:
self.append_sales(line)
self.print_info()
评论列表
文章目录