boto / botocore

The low-level, core functionality of boto3 and the AWS CLI.
Apache License 2.0
1.44k stars 1.06k forks source link

Fix s3 `put_object` example #3177

Open tim-finnigan opened 1 month ago

tim-finnigan commented 1 month ago

Fixes https://github.com/boto/boto3/issues/4126

The example is on this page: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3/client/put_object.html

This PR fixes the example and makes it consistent with other examples here and here.


Although this fixes an inconsistency, the examples are still misleading as mentioned in https://github.com/boto/boto3/issues/4126#issuecomment-2111373090.

Do we want to update each of them to be like this?

with open('HappyFace.jpg', 'rb') as file:
    response = client.put_object(
        Body=file.read(),
        Bucket='examplebucket',
        Key='HappyFace.jpg',
    )
codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 93.14%. Comparing base (8fd0160) to head (f470ce5). Report is 280 commits behind head on develop.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #3177 +/- ## ======================================== Coverage 93.14% 93.14% ======================================== Files 66 66 Lines 14237 14248 +11 ======================================== + Hits 13261 13272 +11 Misses 976 976 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.