init package and add first subpackages
This commit is contained in:
40
src/paveit/helper/minio.py
Normal file
40
src/paveit/helper/minio.py
Normal file
@@ -0,0 +1,40 @@
|
||||
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=False
|
||||
)
|
||||
|
||||
|
||||
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=False
|
||||
)
|
||||
|
||||
found = client.bucket_exists(bucket_name)
|
||||
if not found:
|
||||
client.make_bucket(bucket_name)
|
||||
else:
|
||||
pass
|
||||
|
||||
return client
|
||||
Reference in New Issue
Block a user