[ckan-dev] API upload failing

Sean sean at ivec.org
Wed Jul 3 01:09:20 UTC 2013


Hi Hendrik,

yes, I'm positive I'm using the correct API key cut & pasted from my profile page.

I ran a python -v to check where the ckanclient import is coming from and (in the source) it reads version 0.10 - which I think is the same as the latest in github.

Also, for information, the API reports ckan version 2.0.1

Any ideas? Am I correct in assuming that a return tuple of ('', 'Found') means that the upload_file() call failed?

Cheers.

Sean Fleming
Research Data Specialist

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

+61 8 6436 8918


On 02/07/2013, at 4:35 PM, Hendrik Bunke <bunke.hendrik at gmail.com> wrote:

> --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
> 
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130703/b7de2211/attachment-0001.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/20130703/b7de2211/attachment-0003.bin>


More information about the ckan-dev mailing list