How to use the ckanapi.common.ActionShortcut function in ckanapi

To help you get started, we’ve selected a few ckanapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ckan / ckanapi / ckanapi / testappckan.py View on Github external
def __init__(self, test_app, apikey=None):
        self.test_app = test_app
        self.apikey = apikey
        self.action = ActionShortcut(self)
github ckan / ckanapi / ckanapi / localckan.py View on Github external
def __init__(self, username=None, context=None):
        from ckan.logic import get_action
        self._get_action = get_action

        if username is None:
            username = self.get_site_username()
        self.username = username
        self.context = dict(context or [], user=self.username)
        self.action = ActionShortcut(self)
github ckan / ckanapi / ckanapi / remoteckan.py View on Github external
def __init__(self, address, apikey=None, user_agent=None, get_only=False, session=None):
        self.address = address
        self.apikey = apikey
        self.get_only = get_only
        self.session = session
        if not user_agent:
            user_agent = "ckanapi/{version} (+{url})".format(
                version=__version__,
                url='https://github.com/ckan/ckanapi')
        self.user_agent = user_agent
        self.action = ActionShortcut(self)

        net_loc = urlparse(address)
        if ']' in net_loc:
            net_loc = net_loc[:net_loc.index(']') + 1]
        elif ':' in net_loc:
            net_loc = net_loc[:net_loc.index(':')]
        if net_loc not in MY_SITES:
            # add your sites to MY_SITES above instead of removing this
            self.parallel_limit = PARALLEL_LIMIT