Example #1
0
 def handle(self, *args, **options):
     column = int(options.get('column'))
     csv_file = args[0]
     with open(csv_file, 'rb') as f:
         reader = csv.reader(f)
         for row in reader:
             print row[column]
             endpoint = get_sanitized_endpoint(row[column])
             create_services_from_endpoint(endpoint)
Example #2
0
 def handle(self, *args, **options):
     column = int(options.get('column'))
     csv_file = args[0]
     with open(csv_file, 'rb') as f:
         reader = csv.reader(f)
         for row in reader:
             print row[column]
             endpoint = get_sanitized_endpoint(row[column])
             create_services_from_endpoint(endpoint)
Example #3
0
def update_endpoints(self, endpoint_list):
    from aggregator.utils import create_services_from_endpoint
    # for now we process the enpoint even if they were already processed
    endpoint_to_process = endpoint_list.endpoint_set.all()
    total = endpoint_to_process.count()
    count = 0
    for endpoint in endpoint_to_process:
        # for now we process the enpoint even if they were already processed
        # if not endpoint.processed:
        print 'Processing endpoint %s' % endpoint.url
        imported, message = create_services_from_endpoint(endpoint.url)
        endpoint.imported = imported
        endpoint.message = message
        endpoint.processed = True
        endpoint.save()
        # update state
        if not self.request.called_directly:
            self.update_state(
                state='PROGRESS',
                meta={'current': count, 'total': total}
            )
        count = count + 1
    return True