This commit is contained in:
6
main.py
6
main.py
@@ -483,7 +483,7 @@ async def download_all(dates: DownloadRange, background_tasks: BackgroundTasks):
|
|||||||
while current_date <= finish_date:
|
while current_date <= finish_date:
|
||||||
date_path = current_date.strftime("%Y/%m/%d")
|
date_path = current_date.strftime("%Y/%m/%d")
|
||||||
full_dir_path = os.path.join(DOCUMENTS_DIR, date_path)
|
full_dir_path = os.path.join(DOCUMENTS_DIR, date_path)
|
||||||
logger.info(f"Проверяем путь: {full_dir_path}")
|
# logger.info(f"Проверяем путь: {full_dir_path}")
|
||||||
|
|
||||||
if os.path.exists(full_dir_path):
|
if os.path.exists(full_dir_path):
|
||||||
for file in os.listdir(full_dir_path):
|
for file in os.listdir(full_dir_path):
|
||||||
@@ -492,7 +492,7 @@ async def download_all(dates: DownloadRange, background_tasks: BackgroundTasks):
|
|||||||
|
|
||||||
current_date += timedelta(days=1)
|
current_date += timedelta(days=1)
|
||||||
|
|
||||||
logger.info(f"Найдено файлов: {len(all_files)}")
|
# logger.info(f"Найдено файлов: {len(all_files)}")
|
||||||
|
|
||||||
if not all_files:
|
if not all_files:
|
||||||
return {"error": "Файлы не найдены за указанный период", "date_start": date_start, "date_finish": date_finish}
|
return {"error": "Файлы не найдены за указанный период", "date_start": date_start, "date_finish": date_finish}
|
||||||
@@ -509,7 +509,7 @@ async def download_all(dates: DownloadRange, background_tasks: BackgroundTasks):
|
|||||||
logger.error(f"Ошибка создания архива: {e}")
|
logger.error(f"Ошибка создания архива: {e}")
|
||||||
return {"error": f"Ошибка создания архива: {e}"}
|
return {"error": f"Ошибка создания архива: {e}"}
|
||||||
|
|
||||||
logger.info(f"Архив создан: {archive_path}")
|
# logger.info(f"Архив создан: {archive_path}")
|
||||||
|
|
||||||
# Функция для удаления архива после отдачи
|
# Функция для удаления архива после отдачи
|
||||||
def cleanup_archive():
|
def cleanup_archive():
|
||||||
|
|||||||
Reference in New Issue
Block a user