[ckan-dev] API upload failing
Hendrik Bunke
bunke.hendrik at gmail.com
Tue Jul 2 08:35:31 UTC 2013
--On 2013-07-02 13:35, Sean wrote:
> 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?
Just to be sure: you've provided your API key, right? Also, make
sure that you really use the github master of okfn/ckanclient,
not the egg from PyPi which is rather old and has some issues
with file upload.
regards
hendrik
--
Dr. Hendrik Bunke
http://gplus.to/hbunke
http://twitter.com/hbunke
http://www.hbxt.org
More information about the ckan-dev
mailing list