Skip to content

Commit 0027072

Browse files
committed
pass anon explicitly to s3fs.S3FileSystem
1 parent 06b9467 commit 0027072

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pyiceberg/io/fsspec.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,11 @@ def _s3(properties: Properties) -> AbstractFileSystem:
168168
config_kwargs["read_timeout"] = float(request_timeout)
169169

170170
if s3_anonymous := properties.get(S3_ANONYMOUS):
171-
config_kwargs["anon"] = strtobool(s3_anonymous)
171+
anon = strtobool(s3_anonymous)
172+
else:
173+
anon = False
172174

173-
fs = S3FileSystem(client_kwargs=client_kwargs, config_kwargs=config_kwargs)
175+
fs = S3FileSystem(anon=anon, client_kwargs=client_kwargs, config_kwargs=config_kwargs)
174176

175177
for event_name, event_function in register_events.items():
176178
fs.s3.meta.events.unregister(event_name, unique_id=1925)

tests/io/test_fsspec.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,16 +284,15 @@ def test_fsspec_s3_session_properties_with_anonymous() -> None:
284284
s3_fileio.new_input(location=f"s3://warehouse/{filename}")
285285

286286
mock_s3fs.assert_called_with(
287+
anon=True,
287288
client_kwargs={
288289
"endpoint_url": "http://localhost:9000",
289290
"aws_access_key_id": "admin",
290291
"aws_secret_access_key": "password",
291292
"region_name": "us-east-1",
292293
"aws_session_token": "s3.session-token",
293294
},
294-
config_kwargs={
295-
"anon": True,
296-
},
295+
config_kwargs={},
297296
)
298297

299298

0 commit comments

Comments
 (0)