In the defense of OP, the documentation looks a bit opaque. I considered this while trying to get a custom API action to feed news into JSON, and finally came up with the following:
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
@toolkit.side_effect_free
def get_news(context,data_dict=None):
return {"hello":"world"}
class CustomAPIPlugin(plugins.SingletonPlugin):
plugins.implements(plugins.interfaces.IActions)
def get_actions(self):
return {'get_news': get_news}
A tutorial describing creating an authentication plugin is here:
http://docs.ckan.org/en/latest/extensions/tutorial.html#creating-a-new-extension
I did this to plagiarize, but using IActions, not IAuthFunctions:
http://docs.ckan.org/en/latest/extensions/plugin-interfaces.html
Works on installing CKAN 2.2.1.
source
share