[ckan-dev] ckanapi
Ian Ward
ian at excess.org
Wed Mar 1 23:30:34 UTC 2017
If you're getting a server error check your server logs for the full traceback.
ckanapi's RemoteCKAN class uses requests.post too, so there
*shouldn't* be a difference between using ckanapi.RemoteCKAN and
requests except for getting meaningful exceptions from ckanapi when
something fails.
On Wed, Mar 1, 2017 at 5:19 PM, Stéphane Lapointe <lapointes at ogsl.ca> wrote:
> 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.
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
More information about the ckan-dev
mailing list