design design batch

This commit is contained in:
zhouchengrong
2024-12-11 11:35:41 +08:00
parent 7d54d398c5
commit 2a06825446
3 changed files with 5 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
import io
import json
import logging
import os
@@ -14,6 +15,7 @@ def oss_upload_json(oss_client, json_data, object_name):
file_path = os.path.join(save_dir, object_name)
with open(file_path, 'w') as file:
json.dump(json_data, file, indent=4)
oss_client.fput_object("test", object_name, file_path)
json_bytes = json.dumps(json_data).encode('utf-8')
oss_client.put_object("test", object_name, io.BytesIO(json_bytes), length=len(json_bytes), content_type="application/json")
except Exception as e:
logger.warning(str(e))