From b59392b78bf6530e0ed184c627c3efc2b8929f34 Mon Sep 17 00:00:00 2001 From: Alex Bezdieniezhnykh Date: Sat, 31 May 2025 19:09:42 +0300 Subject: [PATCH] safe model saving --- api_client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api_client.py b/api_client.py index f4c0787..f4eebe4 100644 --- a/api_client.py +++ b/api_client.py @@ -1,5 +1,6 @@ import io import json +import os from http import HTTPStatus from os import path @@ -120,6 +121,8 @@ class ApiClient: part_big = resource_encrypted[part_small_size:] self.cdn_manager.upload(constants.MODELS_FOLDER, big_part_name, part_big) + + os.makedirs(folder, exist_ok=True) with open(path.join(folder, big_part_name), 'wb') as f: f.write(part_big) self.upload_file(small_part_name, part_small, constants.MODELS_FOLDER) \ No newline at end of file