Files
Excel-project2/handlers/s_daemon.py
2026-02-23 13:22:55 +03:00

30 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import os
from schema.pydantic import settings, jsonread
from handlers.handler import Handler
from pathlib import Path
files = os.listdir(settings.INPUTDIR)
for i in ("input", "output"):
path=Path(f"./{i}")
path.mkdir(exist_ok=True)
# Print the files
for file in files:
if file.startswith("~$"): #Проверка не редактируемый ли файл
continue
# Check if item is a file, not a directory
if not os.path.isdir(os.path.join(settings.INPUTDIR, file)):
match file:
case _ if "ozon" in file:
print("Это OZON")
calculate = Handler(file)
calculate.get_articles_with_sales(jsonread.merchant("ozon"), sheet_name="По товарам")
case _ if "yandex" in file:
print("Это Yandex")
calculate = Handler(file)
calculate.get_articles_with_sales(jsonread.merchant("yandex"), sheet_name="Отчёт по товарам")
case _ if "wb" in file:
print("Это WB")
case _:
print("Не распознано")