|
|
@@ -10,9 +10,11 @@ import time |
|
|
|
from typing import Optional |
|
|
|
import urllib.parse |
|
|
|
|
|
|
|
import certifi |
|
|
|
import click |
|
|
|
import minio |
|
|
|
import requests |
|
|
|
import urllib3 |
|
|
|
|
|
|
|
from progress import Progress |
|
|
|
|
|
|
@@ -164,8 +166,23 @@ def single_impl(item_directory: pathlib.Path, ia_collection: str, ia_item_title: |
|
|
|
|
|
|
|
def create_client(): |
|
|
|
logging.info("Connecting to minio...") |
|
|
|
cert_check = True |
|
|
|
timeout = datetime.timedelta(seconds=30).seconds |
|
|
|
total_timeout = datetime.timedelta(seconds=60).seconds |
|
|
|
hclient = urllib3.PoolManager( |
|
|
|
timeout=urllib3.util.Timeout(connect=timeout, read=timeout, total=total_timeout), |
|
|
|
maxsize=10, |
|
|
|
cert_reqs='CERT_REQUIRED' if cert_check else 'CERT_NONE', |
|
|
|
ca_certs=os.environ.get('SSL_CERT_FILE') or certifi.where(), |
|
|
|
retries=urllib3.Retry( |
|
|
|
total=5, |
|
|
|
backoff_factor=0.2, |
|
|
|
backoff_max=30, |
|
|
|
status_forcelist=[500, 502, 503, 504] |
|
|
|
) |
|
|
|
) |
|
|
|
return minio.Minio(endpoint=ep, access_key=parsed_url.username, secret_key=parsed_url.password, |
|
|
|
secure=secure) |
|
|
|
secure=secure, http_client=hclient) |
|
|
|
|
|
|
|
client = retry_failures(create_client, "Failed to connect to minio") |
|
|
|
|
|
|
|