예제 #1
0
def update_location_from_file(filename, kind):
  import os
  from ghost_spider.util import LocationCsv

  f = open(filename, 'rb')
  try:
    LocationCsv.import_file(f, kind)
  finally:
    if f:
      f.close()
예제 #2
0
def export_csv_file(name, kind, action=None):
  from ghost_spider.util import LocationCsv, SalonToCsvFiles
  if kind == 'hotel':
    LocationCsv.dump_hotel(name, action=action)
  elif kind == 'restaurant':
    LocationCsv.dump_restaurant(name, action=action)
  elif kind == 'salon':
    file_generator = SalonToCsvFiles(name)
    file_generator.dump(action=action)
  else:
    NotImplementedError()