Created
November 6, 2012 19:59
-
-
Save doobeh/4027108 to your computer and use it in GitHub Desktop.
StringIO Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stringio_object = your_string_io_object | |
destination_filename = 'whatever' | |
# Connect to S3 | |
conn = boto.connect_s3(app.config["S3_KEY"], app.config["S3_SECRET"]) | |
b = conn.get_bucket(app.config["S3_BUCKET"]) | |
# Upload the File | |
sml = b.new_key("/".join([app.config["S3_UPLOAD_DIRECTORY"],destination_filename])) | |
sml.set_contents_from_string(stringio_object.getvalue()) | |
# Set the file's permissions. | |
sml.set_acl(acl) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment