nectar.blockchainobject module
- class nectar.blockchainobject.BlockchainObject(data: Dict[str, Any] | int | str | Any, klass: type | None = None, space_id: int = 1, object_id: Any | None = None, lazy: bool = False, use_cache: bool = True, id_item: str | None = None, blockchain_instance: Any | None = None, *args, **kwargs)
Bases:
dict- cache() None
- static clear_cache() None
- clear_cache_from_expired_items() None
- get_cache_auto_clean() bool
- get_cache_expiration() int
- getcache(id: Any) Any
- iscached(id: Any) bool
- items()
Return a set-like object providing a view on the dict’s items.
- json() Dict[str, Any]
- refresh() None
Refresh the object’s data from the API.
This method should be overridden by subclasses to implement specific refresh logic. The base implementation does nothing.
- set_cache_auto_clean(auto_clean: bool) None
- set_cache_expiration(expiration: int) None
- space_id = 1
- test_valid_objectid(i: Any) bool
- testid(id: Any) None
- type_id = None
- type_ids = []
- class nectar.blockchainobject.ObjectCache(initial_data: Dict[Any, Any] | None = None, default_expiration: int = 10, auto_clean: bool = True)
Bases:
dict- clear_expired_items() None
- get(key: Any, default: Any = None) Any
Return the value for key if key is in the dictionary, else default.
- set_expiration(expiration: int) None
Set new default expiration time in seconds (default: 10s)