import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
# Required so that GET requests work
@toolkit.side_effect_free
def get_news(context,data_dict=None):
# The actual custom API method
return {"hello":"world"}
class CustomAPIPlugin(plugins.SingletonPlugin):
plugins.implements(plugins.interfaces.IActions)
def get_actions(self):
# Registers the custom API method defined above
return {'get_news': get_news}
在OP的辩护中,文件似乎有点不透明。我一直在研究这一点,试图获得一个定制的API操作来提供JSON新闻提要,最后得出了这样的结论:
本教程介绍如何创建认证插件:
http://docs.ckan.org/en/latest/extensions/tutorial.html#creating-a-new-extension
我所做的就是剽窃,但是使用IActions而不是IAuthFunctions:
http://docs.ckan.org/en/latest/extensions/plugin-interfaces.html
它正在安装ckan2.2.1。在
相关问题 更多 >
编程相关推荐