[ckan-dev] ~/.ckanclientrc

Timothy Lebo lebot at rpi.edu
Wed Jan 2 23:14:54 UTC 2013


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.
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130102/8079f674/attachment.html>


More information about the ckan-dev mailing list