Skip to content

Commit 94e259d

Browse files
committed
add proxy_server key to stores config, use it in interface
1 parent f1c2795 commit 94e259d

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

datajoint/s3.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,20 @@ def __init__(self, endpoint, bucket, access_key, secret_key, *, secure=False, pr
1818
# proxy_server: string, like "https://PROXYSERVER:PROXYPORT/"
1919
# self.client = minio.Minio(endpoint, access_key=access_key, secret_key=secret_key,
2020
# 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],
21+
if proxy_server: # "http://www-cache.gwdg.de:3128"
22+
http_client = urllib3.ProxyManager(
23+
proxy_server,
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+
)
3031
)
31-
)
32-
print('DEBUG http_client')
32+
else:
33+
http_client = None
34+
3335
self.client = minio.Minio(
3436
endpoint,
3537
access_key=access_key,

datajoint/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def get_store_spec(self, store):
138138
spec['subfolding'] = spec.get('subfolding', DEFAULT_SUBFOLDING)
139139
spec_keys = { # REQUIRED in uppercase and allowed in lowercase
140140
'file': ('PROTOCOL', 'LOCATION', 'subfolding', 'stage'),
141-
's3': ('PROTOCOL', 'ENDPOINT', 'BUCKET', 'ACCESS_KEY', 'SECRET_KEY', 'LOCATION', 'secure', 'subfolding', 'stage')}
141+
's3': ('PROTOCOL', 'ENDPOINT', 'BUCKET', 'ACCESS_KEY', 'SECRET_KEY', 'LOCATION', 'secure', 'subfolding', 'stage', 'proxy_server')}
142142

143143
try:
144144
spec_keys = spec_keys[spec.get('protocol', '').lower()]

0 commit comments

Comments
 (0)