Fix get_entry_context to use /source_slice endpoint
The /context endpoint returns entry metadata but not the editable source. The /source_slice endpoint returns the actual source text and sha256sum needed for approving/rejecting entries. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
913e4705b1
commit
116355b502
1 changed files with 4 additions and 5 deletions
|
|
@ -951,18 +951,17 @@ class FavaClient:
|
||||||
|
|
||||||
async def get_entry_context(self, entry_hash: str) -> Dict[str, Any]:
|
async def get_entry_context(self, entry_hash: str) -> Dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
Get entry context including source text and sha256sum.
|
Get entry source text and sha256sum for editing.
|
||||||
|
|
||||||
|
Uses /source_slice endpoint which returns the editable source.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
entry_hash: Entry hash from get_journal_entries()
|
entry_hash: Entry hash from get_journal_entries()
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
{
|
{
|
||||||
"entry": {...}, # Serialized entry
|
|
||||||
"slice": "2025-01-15 ! \"Description\"...", # Beancount source text
|
"slice": "2025-01-15 ! \"Description\"...", # Beancount source text
|
||||||
"sha256sum": "abc123...", # For concurrency control
|
"sha256sum": "abc123...", # For concurrency control
|
||||||
"balances_before": {...},
|
|
||||||
"balances_after": {...}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
@ -973,7 +972,7 @@ class FavaClient:
|
||||||
try:
|
try:
|
||||||
async with httpx.AsyncClient(timeout=self.timeout) as client:
|
async with httpx.AsyncClient(timeout=self.timeout) as client:
|
||||||
response = await client.get(
|
response = await client.get(
|
||||||
f"{self.base_url}/context",
|
f"{self.base_url}/source_slice",
|
||||||
params={"entry_hash": entry_hash}
|
params={"entry_hash": entry_hash}
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue