30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
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("Не распознано")
|
||
|