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

Docs: S3 put_object Body= can be a file-like object, not just bytes #477

Closed
kengruven opened this issue Feb 5, 2016 · 2 comments
Closed
Assignees
Labels
documentation This is a problem with documentation.

Comments

@kengruven
Copy link

In the documentation for put_object, Boto3 docs say that Body is simply:

Body (bytes) -- Object data.

and give the example:

Body=b'bytes',

Empirically, though, a Python file-like object works just fine. And the automated tests depend on this functionality, so it's probably not going away.

It would be nice if the documentation reflected that Body didn't have to be just bytes.

@rayluo
Copy link
Contributor

rayluo commented Feb 15, 2016

Good catch.

Documentation is mostly auto-generated from upstream. We will see what we can do here.

@rayluo rayluo added the documentation This is a problem with documentation. label Feb 15, 2016
@kyleknap kyleknap self-assigned this Mar 4, 2016
@JesterXL
Copy link

If you reached this page like me and found nothing on StackOverflow, you can use normal strings as the parameter to create text files. Here's a sample HTML one:

response = s3_client.put_object(
	Bucket='your-s3-bucket-name',
	Body='a big ole string, or html tags like <h1>Yooo</h1>',
	Key='folder/path/index.html',
	ServerSideEncryption='AES256'
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This is a problem with documentation.
Projects
None yet
Development

No branches or pull requests

4 participants