[ckan-dev] ~/.ckanclientrc
Toby Dacre
toby.okfn at gmail.com
Mon Jan 7 05:32:16 UTC 2013
On 2 January 2013 23:14, Timothy Lebo <lebot at rpi.edu> wrote:
> Hello,
>
> I'm not sure if this is the best place to ask, so if there's a more
> appropriate place please let me know.
>
> I created https://github.com/okfn/ckanclient/issues/15 about some trouble I'm
> having getting ~/.ckanclientrc to work as
> https://github.com/okfn/ckanclient suggests.
>
Looks like that documentation is wrong - not sure if this used to work and
has been broken. We do not seem to look at the config file at any point in
the current master.
Toby
> While the following code works fine, it does not work when I remove the
> api_key argument -- even if I have specified the key in ~/.ckanclientrc (shown
> below).
>
> How can I get the CkanClient to use the API key given in ~/.ckanclientrc?
>
> Thanks for much!
> Tim Lebo
>
> import ckanclient
>
> # Instantiate the CKAN client.
> ckan = ckanclient.CkanClient(base_location='http://datahub.io/api',
> api_key='my-key') ## 403 error if this argument is removed (why isn't ~/.ckanclientrc taking over?).
>
> # Get the details of a package.
> ckan.package_entity_get('instance-hub-fiscal-years')
> package_entity = ckan.last_message
> package_entity['maintainer'] = 'TWC RPI'
>
> print package_entity
>
> ckan.package_entity_put(package_entity)
>
> cat ~/.ckanclientrc
> [index:http://datahub.io]
> api_key = my-key
>
>
>
> _______________________________________________
> 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/20130107/26d9fed4/attachment-0001.html>
More information about the ckan-dev
mailing list