Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ListObjects and ListObjectsV2 examples show MaxKeys as a string, should be an integer #4431

Open
1 task
morzahavi opened this issue Feb 9, 2025 · 1 comment
Assignees
Labels
bug This issue is a confirmed bug. documentation This is a problem with documentation. p3 This is a minor priority issue s3 service-api This issue is caused by the service API, not the SDK implementation.

Comments

@morzahavi
Copy link

Describe the bug

The documentation specifies a string for the variable "MaxKeys" in list_objects_v2 fuction, but this raises an error as it expects an integer.

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3/client/list_objects.html

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

I followed the documentation and got en error:
Invalid type for parameter MaxKeys, value: 2, type: <class 'str'>, valid types: <class 'int'>

Current Behavior

Raises error despite of documentation guidelines

Reproduction Steps

BUCKET = "example_bucket"
PREFIX = "example_prefix"
objects_list = s3.list_objects_v2(
    Bucket=BUCKET,
    Prefix=PREFIX,
    MaxKeys=2
)

Possible Solution

Change documentation, or change the function.

Additional Information/Context

No response

SDK version used

1.36.3

Environment details (OS name and version, etc.)

Ubuntu 24.04.1

@morzahavi morzahavi added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Feb 9, 2025
@RyanFitzSimmonsAK RyanFitzSimmonsAK self-assigned this Feb 10, 2025
@RyanFitzSimmonsAK RyanFitzSimmonsAK added documentation This is a problem with documentation. investigating This issue is being investigated and/or work is in progress to resolve the issue. s3 p3 This is a minor priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Feb 10, 2025
@RyanFitzSimmonsAK
Copy link
Contributor

Hi @morzahavi, thanks for reaching out. Looking at the documentation for both ListObjects and ListObjectsV2, the parameter documentation for MaxKeys seems to correctly document it as an integer.

ListObjects

MaxKeys (integer) – 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.

ListObjectsV2

MaxKeys (integer) – 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.

However, the examples show it as a string. I'll cut a ticket with the service team to make that an integer, and make pull requests to fix it in botocore.

Ticket # for internal use : P199564241

@RyanFitzSimmonsAK RyanFitzSimmonsAK added service-api This issue is caused by the service API, not the SDK implementation. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Feb 10, 2025
@RyanFitzSimmonsAK RyanFitzSimmonsAK changed the title (short issue description) ListObjects and ListObjectsV2 examples show MaxKeys as a string, should be an integer Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug. documentation This is a problem with documentation. p3 This is a minor priority issue s3 service-api This issue is caused by the service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

2 participants