Retrieve a single item.
get_item(
self,
namespace: Sequence[str],
,
key: str,
*,
refresh_ttl: bool | None = None,
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None
) -> Itemclient = get_sync_client(url="http://localhost:8123")
item = client.store.get_item(
["documents", "user123"],
key="item456",
)
print(item)
----------------------------------------------------------------
{
'namespace': ['documents', 'user123'],
'key': 'item456',
'value': {'title': 'My Document', 'content': 'Hello World'},
'created_at': '2024-07-30T12:00:00Z',
'updated_at': '2024-07-30T12:00:00Z'
}| Name | Type | Description |
|---|---|---|
key* | str | The unique identifier for the item. |
namespace* | Sequence[str] | Optional list of strings representing the namespace path. |
refresh_ttl | bool | None | Default: NoneWhether to refresh the TTL on this read operation. If |
headers | Mapping[str, str] | None | Default: NoneOptional custom headers to include with the request. |