Example #1
0
 def import_from_file(self, path, delay, skip_indexed):
     """Import manifests from a newline delimited file of urls."""
     if not os.path.exists(path):
         print("{} is not reachable.".format(path))
         return
     with open(path) as f:
         writer = csv.writer(sys.stdout)
         writer.writerow(('status', 'id', 'url', 'errors', 'warnings'))
         for line in f:
             line = line.strip('\n')
             if skip_indexed:
                 basic_url = get_basic_url(line)
                 if Manifest.objects.indexed().filter(remote_url__contains=basic_url):
                     continue
             res = import_single_manifest(None, line)
             writer.writerow(res)
             time.sleep(delay)
Example #2
0
 def import_manifest(self):
     for m in Manifest.objects.all():
         m.delete()
     import_single_manifest(None, 'http://localhost:8888/misirlou/tests/fixtures/manifest.json')
     self.solr_con.commit()