File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 2020import boto3
2121import botocore
2222import botocore .exceptions
23+ import botocore .session
2324import redis
2425
2526import tensorizer ._version as _version
@@ -1426,6 +1427,20 @@ def open_stream(
14261427
14271428 # Regardless of whether the config needed to be parsed,
14281429 # the endpoint gets a default value based on the operation.
1430+ # First, check for the AWS_ENDPOINT_URL environment variables,
1431+ # otherwise, check if botocore can resolve credentials,
1432+ # otherwise, use default_s3_write_endpoint and default_s3_read_endpoint.
1433+ if not s3_endpoint :
1434+ s3_endpoint = os .environ .get ("AWS_ENDPOINT_URL_S3" ) or None
1435+ if not s3_endpoint :
1436+ s3_endpoint = os .environ .get ("AWS_ENDPOINT_URL" ) or None
1437+ if not s3_endpoint :
1438+ scoped_config = botocore .session .Session ().get_scoped_config ()
1439+ s3_config = scoped_config .get ("s3" )
1440+ if s3_config :
1441+ s3_endpoint = s3_config .get ("endpoint_url" ) or None
1442+ if not s3_endpoint :
1443+ s3_endpoint = scoped_config .get ("endpoint_url" ) or None
14291444
14301445 if is_s3_upload :
14311446 s3_endpoint = s3_endpoint or default_s3_write_endpoint
You can’t perform that action at this time.
0 commit comments