| 123456789101112131415161718192021222324252627282930313233343536 |
- from minio import Minio
- import os
- client = Minio(
- "192.168.77.249:9000",
- access_key="pZEwCGnpNN05KPnmC2Yh",
- secret_key="KfJRuWiv9pVxhIMcFqbkv8hZT9SnNTZ6LPx592D4",
- secure=False
- )
- MINIO_ENDPOINT = "192.168.77.249:9000"
- MINIO_BUCKET = "grading"
- MINIO_BASE_PREFIX = "raspi_img_data"
- DATA_HOST_URL = f"http://{MINIO_ENDPOINT}/{MINIO_BUCKET}/{MINIO_BASE_PREFIX}"
- # try:
- # # 2. 检查存储桶是否存在
- # found = client.bucket_exists(bucket_name)
- # if not found:
- # client.make_bucket(bucket_name)
- # print(f"存储桶 {bucket_name} 已创建")
- # else:
- # print(f"存储桶 {bucket_name} 已存在")
- #
- # cloud_path = os.path.join(data_dir, object_name).replace("\\", "/")
- #
- # client.fput_object(bucket_name, cloud_path, img_path, content_type="image/jpeg")
- # print(f"成功上传 {object_name} 到 {bucket_name}")
- # except Exception as e:
- # print(f"发生错误: {e}")
|