transport_data.util.ckan.Resource¶
- class transport_data.util.ckan.Resource(data: dict | None = None, **kwargs)[source]¶
Bases:
ModelProxyProxy for ckan.model.Resource.
Methods
__init__([data])asdict()Return the original dictionary of object data.
fetch([max_size])Fetch the resource file and cache it locally.
from_file(path)Construct a new instance from a file path.
get(name)Return the value of a single field.
get_item(name[, index])Get a member of a collection.
update(data)Update part or all of the object data.
Attributes
- fetch(max_size: int = 10000000) Path¶
Fetch the resource file and cache it locally.
- Parameters:
max_size – Maximum size of file to download.
- Raises:
AssertionError – if the size of the file is equal to or greater than max_size.
- classmethod from_file(path: pathlib.Path) T¶
Construct a new instance from a file path.