33"""
44from io import BytesIO
55import minio # https://docs.minio.io/docs/python-client-api-reference
6+ import urllib3
67import warnings
78import uuid
89from pathlib import Path
@@ -13,9 +14,28 @@ class Folder:
1314 """
1415 A Folder instance manipulates a flat folder of objects within an S3-compatible object store
1516 """
16- def __init__ (self , endpoint , bucket , access_key , secret_key , * , secure = False , ** _ ):
17- self .client = minio .Minio (endpoint , access_key = access_key , secret_key = secret_key ,
18- secure = secure )
17+ def __init__ (self , endpoint , bucket , access_key , secret_key , * , secure = False , proxy_server = None , ** _ ):
18+ # proxy_server: string, like "https://PROXYSERVER:PROXYPORT/"
19+ # self.client = minio.Minio(endpoint, access_key=access_key, secret_key=secret_key,
20+ # secure=secure)
21+ # TODO implement proxy_server argument
22+ http_client = urllib3 .ProxyManager (
23+ "http://www-cache.gwdg.de:3128" ,
24+ timeout = urllib3 .Timeout .DEFAULT_TIMEOUT ,
25+ cert_reqs = "CERT_REQUIRED" ,
26+ retries = urllib3 .Retry (
27+ total = 5 ,
28+ backoff_factor = 0.2 ,
29+ status_forcelist = [500 , 502 , 503 , 504 ],
30+ )
31+ )
32+ self .client = minio .Minio (
33+ endpoint ,
34+ access_key = access_key ,
35+ secret_key = secret_key ,
36+ secure = secure ,
37+ http_client = http_client ,
38+ )
1939 self .bucket = bucket
2040 if not self .client .bucket_exists (bucket ):
2141 raise errors .BucketInaccessible ('Inaccessible s3 bucket %s' % bucket ) from None
0 commit comments