@retry(Exception)
def update_dataset(dataset_entity_remote, dataset_entity):    
    dataset_entity_remote['url'] = dataset_entity["url"]
    dataset_entity_remote['license_id'] = dataset_entity["license_id"]
    dataset_entity_remote['name'] = dataset_entity["name"]
    dataset_entity_remote['title'] = dataset_entity["title"]
    dataset_entity_remote['notes'] = dataset_entity["notes"]
    dataset_entity_remote['author'] = dataset_entity["author"]
    dataset_entity_remote['maintainer'] = dataset_entity["maintainer"]
    dataset_entity_remote['maintainer_email'] = dataset_entity["maintainer_email"]
    dataset_entity_remote['tags'] = dataset_entity["tags"]
    
    # Process resources
    if not 'resources' in dataset_entity_remote:
       dataset_entity_remote['resources'] = []
        

    print "    Updating resources:"
    for resource in dataset_entity['resources']:
        
        mimetype = ""
        if 'mimetype' in resource:
            mimetype = resource['mimetype']
        
        # Check if a resource is already present with the same mimetype
        # If so, update it, otherwise add as a new resource
        found = False
        for resource_remote in dataset_entity_remote['resources']:
            if 'mimetype' in resource_remote and resource_remote['mimetype'] == mimetype:
                found = True
                break
        
        if (found) :
            print "      Resource found (" + mimetype + ").  Updating..."
            resource_remote["url"] = resource["url"]
            resource_remote["name"] = resource["name"]
            resource_remote["format"] = resource["format"]
            resource_remote["mimetype"] = resource["mimetype"]
        else:
            print "      Resource not found (" + mimetype + ").  Adding..."
            dataset_entity_remote['resources'].append(resource)
            
    ckan_client.package_entity_put(dataset_entity_remote)
Updates a dataset
dataset/ETHPy150Open opencolorado/OpenColorado-Tools-and-Utilities/Scripts/Harvest/Drcog/DrcogSync.py/update_dataset