Hellnar
Hellnar

Reputation: 64853

Boto: Uploading a generated html string to Amazon s3

I need to generate HTML files on the fly and save them to selected folder of the bucket and received the url.

I have seen uploading a file boto however I want to dynamically generate string of HTML a file on amazon s3 without actually saving the file to my local computer.

How can I achieve this?

Upvotes: 4

Views: 1500

Answers (1)

garnaat
garnaat

Reputation: 45906

The example you cite uses the set_contents_from_filename method of the Key object to upload content to S3 from a local file. Alternatively, you could use the set_contents_from_string method of the Key object to upload content from your generated string of HTML. The first argument is the string to upload rather than a path to a file.

Upvotes: 5

Related Questions