fix: json module not in scope for _write_json/_read_json helpers

Ne yaptık:
- Helper fonksiyonlar endpoint seviyesinde tanımlıydı ama json modülü progress_stream() içinde import ediliyordu
- import json as _json_mod ile endpoint seviyesinde import eklendi

Neden yaptık:
- _write_json her kategori scraping sonrası "name 'json' is not defined" hatası veriyordu
- Tüm kategoriler fail oluyordu bu yüzden

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
furkanyigit34
2026-03-27 18:14:18 +03:00
parent 1baaa6fbce
commit 187c59ec9b

View File

@@ -1470,13 +1470,15 @@ async def create_report(
task_id = str(uuid.uuid4())
# Helper functions for non-blocking I/O
import json as _json_mod
def _write_json(path, data):
with open(path, 'w', encoding='utf-8') as f:
json.dump(data, f, ensure_ascii=False, indent=2)
_json_mod.dump(data, f, ensure_ascii=False, indent=2)
def _read_json(path):
with open(path, 'r', encoding='utf-8') as f:
return json.load(f)
return _json_mod.load(f)
def _db_save(db, report):
db.add(report)