Skip to content

Commit

Permalink
Improve s3 functions (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed May 7, 2024
1 parent c5f63b7 commit f32b790
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions leafmap/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8647,6 +8647,7 @@ def s3_list_objects(
ext=None,
fullpath=True,
request_payer="bucket-owner",
client_args={},
**kwargs,
):
"""List objects in a S3 bucket
Expand All @@ -8659,6 +8660,7 @@ def s3_list_objects(
fullpath (bool, optional): Return full path. Defaults to True.
request_payer (str, optional): Specifies who pays for the download from S3.
Can be "bucket-owner" or "requester". Defaults to "bucket-owner".
client_args (dict, optional): Additional arguments to pass to boto3.client(). Defaults to {}.
Returns:
list: List of objects.
Expand All @@ -8668,7 +8670,7 @@ def s3_list_objects(
except ImportError:
raise ImportError("boto3 is not installed. Install it with pip install boto3")

client = boto3.client("s3")
client = boto3.client("s3", **client_args)

if prefix is not None:
kwargs["Prefix"] = prefix
Expand Down Expand Up @@ -8879,7 +8881,7 @@ def s3_get_objects(
if keys is None:
fullpath = False
keys = s3_list_objects(
bucket, prefix, limit, ext, fullpath, request_payer, **kwargs
bucket, prefix, limit, ext, fullpath, request_payer, client_args, **kwargs
)

for index, key in enumerate(keys):
Expand Down

0 comments on commit f32b790

Please sign in to comment.