[ckan-dev] API upload failing

Sean sean at ivec.org
Tue Jul 2 05:35:14 UTC 2013


Hi guys,

I've been experimenting with scripting some automatic data ingestion for the CKAN instance I've set up.

I've been doing some very basic python stuff, taken from here: https://github.com/okfn/ckanclient

Anyway, I can authenticate and create datasets and modify meta data ok but I'm having real trouble adding a resource where the resource is an uploaded file.

Bear in mind that if I manually upload a local file via the web interface this all works fine.

However, via the API, the return tuple from upload_file() is ('', 'Found')

which suggests to me that it failed - since the first value should be a valid url, from in-code comments here:
https://github.com/okfn/ckanclient/blob/master/ckanclient/__init__.py

However, I've got no idea why it's failing as I've made sure that the filename is unique so there should not be any conflict (which was my first thought seeing 'Found')

Besides, I believe a timestamp is used to avoid conflicts in the first place.

Also, I can verify that it failed as when I try to add the file to a dataset via add_package_resource() I get a CkanAPiConflictError

Finally, this is all I see in the apache log when the upload_file() call is made:
[Wed Jun 26 22:04:35 2013] [error] 2013-06-26 22:04:35,798 INFO  [ckan.lib.base]  /api/storage/auth/form/2013-06-26T220435/newfile.txt render time 0.025 seconds
[Wed Jun 26 22:04:35 2013] [error] 2013-06-26 22:04:35,810 INFO  [ckan.lib.base]  /storage/upload_handle render time 0.004 seconds

Any ideas/debugging hints?

Cheers.

Sean Fleming
Research Data Specialist

iVEC, http://www.ivec.org
sean at ivec.org

+61 8 6436 8918




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130702/68b72a58/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2529 bytes
Desc: not available
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130702/68b72a58/attachment-0002.bin>


More information about the ckan-dev mailing list