[ckan-dev] ckanapi

Stéphane Lapointe lapointes at ogsl.ca
Wed Mar 1 22:19:21 UTC 2017


Hi everybody,

I wrote a script to upload resources to CKAN instance. Everything work 
fine except for Excel files. I get a 'Servor Error' while accessing 
resource on Web UI.

This is in essence the code I execute without error.

# resource_dict is set, including package_id and other attributes
resource_dict['upload'] = open('path_to_a_file', 'rb')
ckanremote.action.resource_update(**resource_dict)

Again, this piece of code works for PDF, ZIP, etc. but not for XLS, XSLX

I've activated DataStore and set up FileStorage.

Strangely, when I do

requests.post(url, data={"package_id": "id"}, headers={"X-CKAN-API-Key": 
"my_api_key"}, files=[('upload', file('path_to_a_file'))])

it works perfectly. So I have a solution for my problem, but I would 
like to understand what I'm missing.

Thank you.



More information about the ckan-dev mailing list