class ckan_api_client.utils.IDPair[source]

Bases: ckan_api_client.utils.IDPair

A pair (named tuple) mapping a “source” id with the one used internally in Ckan.

This is mostly used associated with IDMap.

Keys: source_id, ckan_id

class ckan_api_client.utils.SuppressExceptionIf(cond)[source]

Bases: object

Context manager used to suppress exceptions if they match a given condition.

Usage example:

is_404 = lambda x: isinstance(x, HTTPError) and x.status_code == 404
with SuppressExceptionIf(is_404):
class ckan_api_client.utils.IDMap[source]

Bases: object

Two-way hashmap to map source ids to ckan ids and the other way back.


Convert a source id to ckan id


Convert a ckan id to source id


Add a new id pair

Parameters:pair (IDPair) – the id pair to be added
Raises:ValueError – if one of the two ids is found in a mismatching pair

Remove an id pair.

Parameters:pair (IDPair) – the id pair to be removed
Raises:ValueError – if one of the two ids is found in a mismatching pair
class ckan_api_client.utils.FrozenDict(*a, **kw)[source]

Bases: _abcoll.MutableMapping

Frozen dictionary. Acts as a read-only dictionary, preventing changes and returning frozen objects when asked for values.

class ckan_api_client.utils.FrozenSequence(data)[source]

Bases: _abcoll.Sequence

Base class for the FrozenList/FrozenTuple classes. Acts as a read-only sequence type, returning frozen versions of mutable objects.

class ckan_api_client.utils.FrozenList(data)[source]

Bases: ckan_api_client.utils.FrozenSequence

Immutable list-like.

class ckan_api_client.utils.FrozenTuple(data)[source]

Bases: ckan_api_client.utils.FrozenSequence

Immutable tuple-like.


Returns the “frozen” version of a mutable type.

Raises:TypeError – if a frozen version for that object doesn’t exist
class ckan_api_client.utils.WrappedList(*a, **kw)[source]

Bases: _abcoll.MutableSequence

insert(pos, item)[source]