mirror of
https://github.com/nethunterzist/trendyol-analiz
synced 2026-07-03 18:27:04 +00:00
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:
@@ -1470,13 +1470,15 @@ async def create_report(
|
|||||||
task_id = str(uuid.uuid4())
|
task_id = str(uuid.uuid4())
|
||||||
|
|
||||||
# Helper functions for non-blocking I/O
|
# Helper functions for non-blocking I/O
|
||||||
|
import json as _json_mod
|
||||||
|
|
||||||
def _write_json(path, data):
|
def _write_json(path, data):
|
||||||
with open(path, 'w', encoding='utf-8') as f:
|
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):
|
def _read_json(path):
|
||||||
with open(path, 'r', encoding='utf-8') as f:
|
with open(path, 'r', encoding='utf-8') as f:
|
||||||
return json.load(f)
|
return _json_mod.load(f)
|
||||||
|
|
||||||
def _db_save(db, report):
|
def _db_save(db, report):
|
||||||
db.add(report)
|
db.add(report)
|
||||||
|
|||||||
Reference in New Issue
Block a user