downloading from s3

143 views
Skip to first unread message

Daniel W

unread,
Jul 19, 2012, 5:23:42 PM7/19/12
to boto-...@googlegroups.com
I'm trying to use boto to download a large file from an s3 bucket, and I'm a little confused by which method I should use.
Am I right that I should be using key.getfile()?

Chris Moyer

unread,
Jul 19, 2012, 5:55:58 PM7/19/12
to boto-...@googlegroups.com, boto-...@googlegroups.com
Key objects are similar to file objects in python, so you can just do read() to get the contents, or one of the special methods:
get_contents_as_string()
get_contents_to_filename("somefile")
get_contents_to_file(some_file_pointer)

But I prefer just to treat it as a string, unless you specifically want it downloaded to your file system. 

--------------------------------
Sent from my iPhone
Chris Moyer
VP of Technology, Newstex LLC
Please log all support requests to http://support.newstex.com

On Jul 19, 2012, at 5:23 PM, Daniel W <dweitz...@gmail.com> wrote:

I'm trying to use boto to download a large file from an s3 bucket, and I'm a little confused by which method I should use.
Am I right that I should be using key.getfile()?

--
You received this message because you are subscribed to the Google Groups "boto-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/boto-users/-/_A-lG9Y2FmIJ.
To post to this group, send email to boto-...@googlegroups.com.
To unsubscribe from this group, send email to boto-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/boto-users?hl=en.

Daniel W

unread,
Jul 20, 2012, 10:24:31 AM7/20/12
to boto-...@googlegroups.com
Ah, thanks Chris.
I had tried get_contents_to_filename() and it stopped mid-download, so I figured I was doing something wrong.  Turns out it was a disk space issue.
Reply all
Reply to author
Forward
0 new messages