MCPcopy Create free account
hub / github.com/astral-sh/python-build-standalone / make_s3_client

Function make_s3_client

pythonbuild/mirror.py:150–172  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

148
149
150def make_s3_client() -> tuple[Boto3S3Client, TransferConfig]:
151 endpoint_url = os.environ.get("AWS_ENDPOINT_URL")
152 region_name = os.environ.get("AWS_DEFAULT_REGION") or os.environ.get("AWS_REGION")
153 if endpoint_url and region_name is None:
154 region_name = "auto"
155
156 client_kwargs: dict[str, Any] = {
157 "config": Config(
158 signature_version="s3v4",
159 retries={"max_attempts": MAX_ATTEMPTS, "mode": "standard"},
160 s3={"addressing_style": "path"},
161 )
162 }
163 if endpoint_url:
164 client_kwargs["endpoint_url"] = endpoint_url
165 if region_name:
166 client_kwargs["region_name"] = region_name
167
168 session = boto3.session.Session()
169 client = session.client("s3", **client_kwargs)
170 transfer_config = TransferConfig()
171
172 return client, transfer_config
173
174
175@dataclass(kw_only=True)

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected