From 187c59ec9ba1ea66382018ed36f9dee07341bbe9 Mon Sep 17 00:00:00 2001 From: furkanyigit34 <134547018+furkanyigit34@users.noreply.github.com> Date: Fri, 27 Mar 2026 18:14:18 +0300 Subject: [PATCH] fix: json module not in scope for _write_json/_read_json helpers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- backend/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/main.py b/backend/main.py index f1cff9a..017c3d4 100644 --- a/backend/main.py +++ b/backend/main.py @@ -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)