build 039: complete Quotes Feed migration foundation
This commit is contained in:
23
app/tools/dzengi_probe/response_store.py
Normal file
23
app/tools/dzengi_probe/response_store.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# app/tools/dzengi_probe/response_store.py
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
def save_json(path: Path, payload: Any) -> None:
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
with path.open("w", encoding="utf-8") as file:
|
||||
json.dump(payload, file, ensure_ascii=False, indent=2, sort_keys=True)
|
||||
file.write("\n")
|
||||
|
||||
|
||||
def append_jsonl(path: Path, payload: Any) -> None:
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
with path.open("a", encoding="utf-8") as file:
|
||||
file.write(json.dumps(payload, ensure_ascii=False, sort_keys=True))
|
||||
file.write("\n")
|
||||
Reference in New Issue
Block a user