by
1
8
6,112
1
Top 1% !
Popular
Famous
Pearl of Wisdom
Tagged
Easy-to-find
Specified
OpenSource
Popularity: 1079th place
Created
Modified Aug 4, 2013

Published on:

Architecturex86_64
LanguagePython
LicenseMIT_X11
Target Frameworkaws

Amazon S3 Aws - get_bucket method in boto python API

This example shows how to get a single key from a bucket and then write that key to a file.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/4427/Amazon-S3-Aws---get_bucket-method-in-bot?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
from boto.s3.connection import S3Connection from boto.s3.key import Key # Get connection using Amazon secret and access keys conn = S3Connection('<aws secret key>', '<aws access key>') # Get the bucket with name 'bucketname' bucket = conn.get_bucket('bucketname') # Get the key reference to file 'picture.jpg' key = bucket.get_key("picture.jpg") # Open file in write mode fp = open ("picture.jpg", "w") # Set the reference to file key.get_file (fp)

Other Steps and Solutions

If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus