Open earthquakesan opened 11 years ago
Good idea. If you want something right now do:
client = ckanclient.CkanClient(base_location, api_key)
resource_id = 'xyz'
query = 'jones'
client.action('datastore_search',
resource_id=resource_id,
q=query
)
See the docs at: http://docs.ckan.org/en/ckan-2.0.1/datastore-api.html#ckanext.datastore.logic.action.datastore_search
Plus also cf https://gist.github.com/rgrp/3813564#file-load-py
I think that we shouldn't add all the action functions as separate functions, in the manner that we did for the API v1/v2. There are so many of them, and they have a pythonic interface, there's not much to gain repeating them in the ckanclient code.
The one improvement that might help would be to allow this syntax:
client.action.datastore_search(
resource_id=resource_id,
q=query
)
where 'datastore_search' is not a real method, but captured by def __getattr__(self, name)
and it calls the existing action method. This is what is done in the admirable alternative API that focuses exclusively on the action API: https://github.com/wardi/ckanapi
Add a method reflecting CKAN API resource search mechanism. Example (from CKAN API doc): http://demo.ckan.org/api/3/action/resource_search?query=name:District%20Names