Skip to content

Instantly share code, notes, and snippets.

@urkonn
Created February 29, 2016 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save urkonn/29e140b595f8de0319c8 to your computer and use it in GitHub Desktop.
Save urkonn/29e140b595f8de0319c8 to your computer and use it in GitHub Desktop.
creates a new group in CKAN with existing datasets
import os
import ckanapi
HOST = os.getenv('CKAN_HOST')
TOKEN = os.getenv('CKAN_API_TOKEN')
remote = ckanapi.RemoteCKAN(HOST, user_agent='ckanops/1.0', apikey=TOKEN)
remote.action.group_create(name='group-name',
packages=[{'id': 'dataset-name1'},
{'id': 'dataset-name2'},
{'id': 'dataset-name3'}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment