I'm trying to upload a data package with resources to CKAN (via Python). I can upload the package successfully without the "resources", but I keep hitting this error with them:
'message': "Only lists of dicts can be placed against subschema ('resources',), not <type 'list'>"
I've tried reformatting the Python dictionary several times and also used json.dumps() on the dictionary, but I then hit a json error when calling the API.
test_dict =
{
'title': 'title of my dataset',
'start': '2018-09-15 00:00:00',
'end': '2018-09-20 00:00:00',
'fact': 'interesting fact',
'ReportNo': 1234,
'type': 'data',
'notes': ' ',
'owner_org': 'Org',
'maintainer': 'Me',
'name': 'Test package for S3',
'resources': [
{
'package_id': '',
'url': 'https://s3-test-bucket/test.txt',
'name': 'S3 URL testing',
'description': 'does description work?'
}
]
}
response = requests.post(url, test_dict, headers=auth)
response.json()
Expecting: 'success':'True'
Getting: 'message': "Only lists of dicts can be placed against subschema ('resources',), not ", '__type': 'Integrity Error'
Please can someone explain the correct Python dictionary format? Preferably with examples.
Thanks!