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: LOGGER.debug(row[column]) endpoint = get_sanitized_endpoint(row[column]) create_services_from_endpoint(endpoint)
def update_endpoint(self, endpoint): from hypermap.aggregator.utils import create_services_from_endpoint print 'Processing endpoint with id %s: %s' % (endpoint.id, endpoint.url) imported, message = create_services_from_endpoint(endpoint.url) endpoint.imported = imported endpoint.message = message endpoint.processed = True endpoint.save()
def update_endpoint(self, endpoint): from hypermap.aggregator.utils import create_services_from_endpoint print 'Processing endpoint with id %s: %s' % (endpoint.id, endpoint.url) imported, message = create_services_from_endpoint(endpoint.url) endpoint.imported = imported endpoint.message = message endpoint.processed = True endpoint.save()
def update_endpoint(self, endpoint, greedy_opt=False): from hypermap.aggregator.utils import create_services_from_endpoint from hypermap.aggregator.models import Endpoint LOGGER.debug('Processing endpoint with id %s: %s' % (endpoint.id, endpoint.url)) # Override the greedy_opt var with the value from the endpoint list # if it's available. if endpoint.endpoint_list: greedy_opt = endpoint.endpoint_list.greedy imported, message = create_services_from_endpoint(endpoint.url, greedy_opt=greedy_opt, catalog=endpoint.catalog) # this update will not execute the endpoint_post_save signal. Endpoint.objects.filter(id=endpoint.id).update( imported=imported, message=message, processed=True )