ckanapi_harvesters.ckan_api.dev package

Submodules

ckanapi_harvesters.ckan_api.dev.ckan_api_local module

Version of CkanApi to control a local CKAN server

class ckanapi_harvesters.ckan_api.dev.ckan_api_local.LocalCkanApi(url: str = None, *, proxies: str | dict | ProxyConfig = None, apikey: str | CkanApiKey = None, apikey_file: str = None, owner_org: str = None, params: LocalCkanApiParams = None, map: CkanMap = None, policy: CkanPackageDataFormatPolicy = None, policy_file: str = None, data_cleaner_upload: CkanDataCleanerABC = None, identifier=None, username: str = None, context: dict = None)

Bases: CkanApiManage

__init__(url: str = None, *, proxies: str | dict | ProxyConfig = None, apikey: str | CkanApiKey = None, apikey_file: str = None, owner_org: str = None, params: LocalCkanApiParams = None, map: CkanMap = None, policy: CkanPackageDataFormatPolicy = None, policy_file: str = None, data_cleaner_upload: CkanDataCleanerABC = None, identifier=None, username: str = None, context: dict = None)

CKAN Database API interface to a local CKAN installation with helper functions using pandas DataFrames. Requires package ckan to be installed.

Parameters:
  • url – url of the CKAN server

  • proxies – proxies to use for requests

  • apikey – way to provide the API key directly (optional)

  • apikey_file – path to a file containing a valid API key in the first line of text (optional)

  • policy – data format policy to use with policy_check function

  • policy_file – path to a JSON file containing the data format policy to use with policy_check function

  • owner_org – name of the organization to limit package_search (optional)

  • params – other connection/behavior parameters

  • map – map of known resources

  • policy – data format policy to be used with the policy_check function.

  • policy_file – path to a JSON file containing the data format policy to load.

  • data_cleaner_upload – data cleaner object to use before uploading to a CKAN DataStore.

  • identifier – identifier of the ckan client

_api_get_site_user(*, ignore_auth: bool = True, params: dict = None) dict | None

API call to get_site_user. With no params, returns the name of the current user logged in.

Only internal services allowed to use this action

Returns:

dict with information on the current user

get_site_username(*, ignore_auth: bool = False, params: dict = None) str
class ckanapi_harvesters.ckan_api.dev.ckan_api_local.LocalCkanApiParams(*, proxies: str | dict | ProxyConfig = None, ckan_headers: dict = None, http_headers: dict = None, username: str = None, context: dict = None)

Bases: CkanApiExtendedParams

ckanapi_harvesters.ckan_api.dev.ckan_api_local._write_temp_file(f)

Pull all data from stream f into a temporary file

Caller must close file returned.

Module contents

Modules under development