Files
lib-paveit-demo/src/paveit/helper/minio.py
2023-06-02 08:53:44 +02:00

40 lines
901 B
Python
Executable File

import os
from minio import Minio
def get_minio_client_processing(bucket_name = 'processing'):
client = Minio(
os.environ["MINIO_URL"],
access_key=os.environ["MINIO_ACCESS_KEY"],
secret_key=os.environ["MINIO_SECRET_KEY"],
secure=True
)
found = client.bucket_exists(bucket_name)
if not found:
client.make_bucket(bucket_name)
else:
pass
return client
def get_minio_client_archive(bucket_name = 'archive'):
client = Minio(
os.environ["MINIO_ARCHIVE_URL"],
access_key=os.environ["MINIO_ARCHIVE_ACCESS_KEY"],
secret_key=os.environ["MINIO_ARCHIVE_SECRET_KEY"],
secure=True
)
found = client.bucket_exists(bucket_name)
if not found:
client.make_bucket(bucket_name)
else:
pass
return client