[ckan-dev] A new ckan client library: ckanapi
Heinrich Widmann
widmann at dkrz.de
Mon Apr 29 11:22:31 UTC 2013
Am 27.04.2013 17:31, schrieb Ian Ward:
> On Wed, Apr 24, 2013 at 2:53 PM, Heinrich Widmann <widmann at dkrz.de> wrote:
>> Ok, then what should be used just to do some really basic things :
>>
>> 1. create a data set (just with default keys 'author' and 'maintainer')
>> 2. update new meta data (key:value pairs) to the data set (as well
>> extras-fields)
>> 3. add the dataset to a group
>>
>> Likely we go in the total wrong direction - but I'm pretty sure, that there
>> is an easy way or perform this simple upload actions with the CKAN APIs !?
>>
>> Maybe you can send us a python code, that performs at least the create and
>> update step ?
>> This would help a lot !
> Some more testing revealed a problem with ckanapi and CKAN running
> under Apache: Apache may not pass through the 'Authorization' header,
> so I've switched to the 'X-CKAN-API-Key' header. If you were getting
> NotAuthorized errors this fix might help you.
Yes, our CKAN runs under Apache. And I tried already with
'X-CKAN-API-Key' header - but it seems to make no difference.
>
> Here's a simple package_create with extras using ckanapi:
>
> import ckanapi
> dev = ckanapi.RemoteCKAN('http://my-dev-ckan', api_key='fd7bd...')
> dev.action.package_create(
> name='simple-test',
> extras=[{'key': 'custom-field', 'value': 'extended data'}])
>
> where the last line is the same as:
>
> dev.call_action('package_create', dict(
> name='simple-test',
> extras=[{'key': 'custom-field', 'value': 'extended data'}]))
Ok, tried as well like this. No problem to create data sets without
extras, but requests with extras hangs for ever :
In [96]: ckan_object.call_action('package_create', dict(
name='simple-testtt',extras=[{'key': 'location', 'value':
'extended data'}]))
..................... ?????????????
I tried it as well with the package requests from project
https://github.com/PyBossa/pybossa
but the behaviour is the same.
And as well I can se nothing in the ckan.log except :
2013-04-29 13:05:06,879 DEBUG [ckanext.spatial.model.package_extent]
Spatial tables already exist
2013-04-29 13:05:07,183 DEBUG [ckanext.harvest.plugin] Using auth
profile at ckanext.harvest.logic.auth
2013-04-29 13:05:32,209 DEBUG [ckanext.harvest.model] Harvest tables
defined in memory
2013-04-29 13:05:32,212 DEBUG [ckanext.harvest.model] Harvest tables
already exist
2013-04-29 13:05:32,226 DEBUG [ckanext.spatial.model.package_extent]
Spatial tables defined in memory
2013-04-29 13:05:32,234 DEBUG [ckanext.spatial.model.package_extent]
Spatial tables already exist
2013-04-29 13:05:32,564 DEBUG [ckanext.harvest.plugin] Using auth
profile at ckanext.harvest.logic.auth
But this seems to be default messages, or ?
( Maybe I should point out that we installed the extension
ckanext-spatial to allow geo-spatial faceted search.
Could this impact the generation of extras fields ? )
I really don't know what I shall do - but we urgently need to be filled
this extras for our project !
So I'm very helpful for any help.
Thanks,
Heinrich
>
> Ian
>
> _______________________________________________
> 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
--
-----------------------------\\---------------------------------------
Heinrich Widmann \\ Deutsches Klimarechenzentrum GmbH
Phone: +49 40 460094 282 \\ Abteilung Datenmanagement
FAX: +49 40 460094 270 \\ Bundesstr. 45a
Email: widmann at dkrz.de \\ D-20146 Hamburg
http://www.dkrz.de \\ Germany
-----------------------------------\\---------------------------------
More information about the ckan-dev
mailing list