Skip to content

S3Client.list_objects

rboto-s3==0.4.0 · Service index · Types

Model summary (excerpt): This operation is not supported for directory buckets. Returns some or all (up to 1,000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket. A 200 OK response can contain valid or invalid XML. Be sure to design your application to parse the contents of the response and handle it appropriately. This action has been...

Install and imports

python -m pip install "rboto[s3]==0.4.0"
from rboto import S3Client
from collections.abc import Sequence
from rboto_s3.types import (
    EncodingType,
    ListObjectsOutput,
    OptionalObjectAttributes,
    RequestPayer,
)

Signature

async def list_objects(
    *,
    bucket: str,
    delimiter: str | None = None,
    encoding_type: EncodingType | None = None,
    marker: str | None = None,
    max_keys: int | None = None,
    prefix: str | None = None,
    request_payer: RequestPayer | None = None,
    expected_bucket_owner: str | None = None,
    optional_object_attributes: Sequence[OptionalObjectAttributes] | None = None,
) -> ListObjectsOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
bucket Yes The name of the bucket containing the objects. Directory buckets - When you use this operation with a directory bucket, you must use virtual-hosted-style requests in the format Bucket-name .s3express- zone-id . region-code .amazonaws.com . Path-style requests are not supported. Directory bucket names must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket names must follow...
delimiter No A delimiter is a character that you use to group keys. CommonPrefixes is filtered out from results if it is not lexicographically greater than the key-marker.
encoding_type No
marker No Marker is where you want Amazon S3 to start listing from. Amazon S3 starts listing after this specified key. Marker can be any key in the bucket.
max_keys No Sets the maximum number of keys returned in the response. By default, the action returns up to 1,000 key names. The response might contain fewer keys but will never contain more.
prefix No Limits the response to keys that begin with the specified prefix.
request_payer No Confirms that the requester knows that she or he will be charged for the list objects request. Bucket owners need not specify this parameter in their requests.
expected_bucket_owner No The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied).
optional_object_attributes No Specifies the optional fields that you want returned in the response. Fields that you do not specify are not returned.

Output

ListObjectsOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
is_truncated bool | None Always present —
marker str | None Always present —
next_marker str | None Always present —
contents list[ObjectOutput] | None Always present ObjectOutput
name str | None Always present —
prefix str | None Always present —
delimiter str | None Always present —
max_keys int | None Always present —
common_prefixes list[CommonPrefixOutput] | None Always present CommonPrefixOutput
encoding_type EncodingTypeOutput | None Always present EncodingTypeOutput
request_charged RequestChargedOutput | None Always present RequestChargedOutput

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

EncodingType, ListObjectsOutput, OptionalObjectAttributes, RequestPayer

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

client.paginators.list_objects(...) accepts the same arguments and returns AsyncIterator[ListObjectsOutput]. Direct calls return one page. Pages preserve the Output representation above.

Input cursors: marker. Page-size argument: max_keys.

No output stream.

Errors

Import from rboto_s3.exceptions:

NoSuchBucketError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model