Skip to content

Instantly share code, notes, and snippets.

@doobeh
Created November 6, 2012 19:59
Show Gist options
  • Save doobeh/4027108 to your computer and use it in GitHub Desktop.
Save doobeh/4027108 to your computer and use it in GitHub Desktop.
StringIO Example
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