awswrangler.s3.list_objects

awswrangler.s3.list_objects(path: str, boto3_session: Optional[boto3.session.Session] = None) → List[str]

List Amazon S3 objects from a prefix.

Parameters
  • path (str) – S3 path (e.g. s3://bucket/prefix).

  • boto3_session (boto3.Session(), optional) – Boto3 Session. The default boto3 session will be used if boto3_session receive None.

Returns

List of objects paths.

Return type

List[str]

Examples

Using the default boto3 session

>>> import awswrangler as wr
>>> wr.s3.list_objects('s3://bucket/prefix')
['s3://bucket/prefix0', 's3://bucket/prefix1', 's3://bucket/prefix2']

Using a custom boto3 session

>>> import boto3
>>> import awswrangler as wr
>>> wr.s3.list_objects('s3://bucket/prefix', boto3_session=boto3.Session())
['s3://bucket/prefix0', 's3://bucket/prefix1', 's3://bucket/prefix2']